AutoHotkey Community

It is currently May 27th, 2012, 5:24 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: February 8th, 2011, 3:04 am 
Offline

Joined: August 17th, 2006, 3:26 pm
Posts: 68
I have this little snippet of code. It will toggle two different tools (line and parabola tool) with one key. However, when using this in a sub window of my application, the mouse position doesn't get restored correctly. The mouse jumps around in all corners when executing the hotkey. Could it be, that the sub-window prevents AHK to get the correct mouse position?

Code:
LineTool := 0

c::

if LineTool = 0
{
;   Select line tool
   #IfWinActive, Cubase 6
   MouseGetPos,X,Y
   Send {Click right down}
   MouseMove, 85, 30, R
   Send {Click}
   Send {Down}
   Send {Enter}
   Send {Click right up}
   MouseMove, X,Y
   LineTool := 1
   return
}

else
{
;   select parabola tool
   #IfWinActive, Cubase 6
   MouseGetPos,X,Y
   Send {Click right down}
   MouseMove, 85, 30, R
   Send {Click}
   Send {Down}
   Send {Down}
   Send {Enter}
   Send {Click right up}
   MouseMove, X,Y
   LineTool := 0
   return
}



Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 8th, 2011, 3:40 am 
Offline

Joined: April 8th, 2009, 8:23 pm
Posts: 3036
Location: Rio de Janeiro - RJ - Brasil
Not sure, but try CoordMode.

_________________
"Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried.
"
Image
Antonio França
My stuff: Google Profile


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 8th, 2011, 4:07 pm 
Offline

Joined: August 17th, 2006, 3:26 pm
Posts: 68
Thanks will check!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 8th, 2011, 8:57 pm 
Offline

Joined: August 17th, 2006, 3:26 pm
Posts: 68
Damn, still shows this issue :(
When I get rid of the toggle and execute each script on its own key,
I don't have that problem, though. Any idea what could cause this?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2011, 1:12 am 
Offline

Joined: August 17th, 2007, 6:46 am
Posts: 5
Actually I had the same problem for a while.
Just change
MouseMove x, y, R
to
MouseMove x, y,,R


in other words, just add a comma.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2011, 12:29 pm 
Offline

Joined: August 17th, 2006, 3:26 pm
Posts: 68
Tried that, didn't work though :(
I believe it's the program I use (Cubase) that makes MouseMove not behave correctly.

Another thing I did, was to undo the mouse movement by using negative values.

Here's what it look like when the mouse jumps:

Image

And here is what the script looks like atm:

Code:
CoordMode, Mouse, Relative
LineTool := 0
#IfWinActive, Cubase 6, Key Editor

c::

if LineTool = 0
{
;   Select line tool
   MouseGetPos, X1, Y1
   Send {Click right down}
   MouseMove, 80, 30, 10, R
   Send {Click}
   Send {Down}
   Send {Enter}
   Send {Click right up}
   MouseMove, X1, Y1
   LineTool := 1
   return
}

else
{
;   select parabola tool
   MouseGetPos, X2, Y2
   Send {Click right down}
   MouseMove, 80, 30, 10, R
   Send {Click}
   Send {Down}
   Send {Down}
   Send {Enter}
   Send {Click right up}
   MouseMove, X2, Y2
   LineTool := 0
   return
}


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Exabot [Bot], HotkeyStick, rbrtryn, XstatyK, Yahoo [Bot] and 86 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group