AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Dragable ruler

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Phoenix



Joined: 23 Sep 2005
Posts: 39

PostPosted: Tue Dec 18, 2007 10:39 pm    Post subject: Dragable ruler Reply with quote

Hi I would like a variant of this ruler. I don't want it to follow the mouse but it should be possible to move it up and down by "click and drag"in it. Could anybody give me a hint? Smile

Code:


SetWinDelay, -1

~CapsLock:: ; Feststellen-Taste
  ; Doppelklick erkennen
   if A_PriorHotkey <> ~CapsLock
   {
      KeyWait, CapsLock
      return
   }
   if A_TimeSincePriorHotkey > 400
   {
      KeyWait, CapsLock
      return
   }

   ; Wenn Lineal aus, dann einschalten
   If Ruler <> on
   {
      SetTimer,Ruler,0
   }
   else ; Sonst wieder ausschalten
   {
      SetTimer,Ruler,Off
      Ruler = Off
      Splashimage,3:Off
   }
Return

Ruler:
   Coordmode, Mouse, Screen    ; Mauskoordinaten beziehen sich auf den gesamten Bildschirm
   MouseGetPos,, RulerY        ; Y-Koordinate der Maus
   RulerY -= 2                 ; 2 Pixel nach oben schieben
   if Ruler <> on              ; Beim ersten Aufruf
      Splashimage,3:, B H1 W%A_ScreenWidth% X0 Y%RulerY% CWcc9900,,,ScreenRuler
   else                        ; Linie ist schon an, dann nur verschieben
      WinMove, ScreenRuler,,, %RulerY%
   Ruler = on                  ; Linie gilt nun als aktiviert
return
Back to top
View user's profile Send private message
Dra_Gon



Joined: 25 May 2007
Posts: 198

PostPosted: Tue Dec 18, 2007 11:47 pm    Post subject: Reply with quote

Well, I don't know what "ruler" you're talking about {or the language used for your comments}, but if the ruler can be moved, you SHOULD be able to assign a modifier with your mouse click to move it where you want.
This is an example in the "Hotkeys" section of the help file:
Code:
!MButton::  ; Middle mouse button. The ! prefix makes it fire while the Alt key is down (which it is if the alt-tab menu is visible).
IfWinExist ahk_class #32771  ; Indicates that the alt-tab menu is present on the screen.
    Send !{Escape}{Alt up}
return

Look there and see what you can find.

Dra'Gon
_________________

For a good laugh {hopefully} >> megamatts.50megs.com

SciFi/Fantasy Short Stories I wrote {StohlerWorlds I} >>
http://www.mediafire.com/?2yisetu0jud
Back to top
View user's profile Send private message Send e-mail
DerRaphael



Joined: 23 Nov 2007
Posts: 429
Location: Heidelberg, Germany

PostPosted: Wed Dec 19, 2007 2:09 am    Post subject: Reply with quote

me is being nice today

Code:

SetWinDelay, -1

~CapsLock::
   if A_PriorHotkey <> ~CapsLock
   {
      KeyWait, CapsLock
      return
   }
   if A_TimeSincePriorHotkey > 400
   {
      KeyWait, CapsLock
      return
   }

   ; if shown line is off, turn it back on
   If (Ruler != "On")
   {
      MouseGetPos,, RulerY     ; Y-Coord of mouse
      RulerY -= 2              ; move 2 pixel up
      Splashimage,3:, B H1 W%A_ScreenWidth% X0 Y%RulerY% CWcc9900,,,ScreenRuler
      Ruler = On
   }
   else ; turn it off
   {
      Ruler = Off
      Splashimage,3:Off
   }
Return

^LButton::
   SetTimer,MoveRuler,0
return

^LButton up::
   SetTimer,MoveRuler,OFF
   Coordmode, Mouse, Screen    ; MouseCoordinates relate to entire screen
   MouseGetPos,, RulerY        ; Y-Coord of mouse
   RulerY -= 2                 ; move 2 pixel up
   WinMove, ScreenRuler,,, %RulerY%
return

MoveRuler:
   Coordmode, Mouse, Screen
   MouseGetPos,, RulerY
   RulerY -= 2
   WinMove, ScreenRuler,,, %RulerY%
return


the screen ruler (an one pixel line) is activated by 'double clicking' the caps lock key

it gets positioned wherever the mouse is

it also can be moved with ctrlKey down and left mouse button

greets
derRaphael


btw ...
phoenix - ich zweifel daran, dass das dein script ist - hättest du sowas schreiben können, müsste dir eigentlich klar sein, wie man das gemäß deinen wünschen modifiziert - wenn du also schon die scripte anderer leute verwendest, sei doch so nett und gib wenigstens an, wo du das gefunden hast und wer es ursprünglich schuf

phoenix - i doubt that this is actually your script - if you could write such a script, im pretty sure you'd be able to modify it to suit your needs better - since you are using the scripts of other people, please also give credit to those and tell where you found it
_________________
Code:
If ((myWish="post in forum") && (!(haveAccount) || !(loggedIn))) {
    MsgBox, 64, Forum Hint, It's a good idea to sign up and/or login to post in forum!
} else if ((RTFM) && (searchedForum) && (usesBrain)) {
    Send, %Request%
}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group