KEY_DOWN Event

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
sjewins
Newbie
Posts: 3
Joined: Fri Apr 16, 2010 3:26 pm

KEY_DOWN Event

Post by sjewins » Fri Apr 16, 2010 3:36 pm

I have this as the first line of my script.

OnEvent>KEY_DOWN,VK_F1,,GetDataPos

Then I have this subroutine.

SRT>GetDataPos
GetCursorPos>nXPos,nYPos
Let>Dialog1.Caption=Robo:%nXPos%,%nYPos%
End>GetDataPos

I run the script and move the mouse somewhere on the screen, press F1 and nothing. I put a breakpoint in the subroutine and repeat as above and nothing. The subroutine isn't getting called. I can't see why not.

Any help appreciated.

User avatar
Marcus Tettmar
Site Admin
Posts: 7391
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Apr 16, 2010 3:59 pm

Do you have anything else in your script? If not it will exit before you can blink your eyes, so it won't do anything.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

sjewins
Newbie
Posts: 3
Joined: Fri Apr 16, 2010 3:26 pm

Post by sjewins » Fri Apr 16, 2010 4:14 pm

mtettmar wrote:Do you have anything else in your script? If not it will exit before you can blink your eyes, so it won't do anything.
Yes I do. All the other things work perfectly.

User avatar
JRL
Automation Wizard
Posts: 3518
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Apr 16, 2010 4:21 pm

I couldn't make this work with your syntax. I've always used the form VK(number) so in the case of F1 it will be VK112. Also even with VK112 in the line I also need a value in the parameter after the VK for the . Try this and see what happens.

OnEvent>KEY_DOWN,VK112,0,GetDataPos

User avatar
Marcus Tettmar
Site Admin
Posts: 7391
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Apr 16, 2010 4:26 pm

Good catch JRL. Yes, it should be as JRL posted it. Sorry I missed the obvious.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

sjewins
Newbie
Posts: 3
Joined: Fri Apr 16, 2010 3:26 pm

Post by sjewins » Fri Apr 16, 2010 4:44 pm

JRL wrote:I couldn't make this work with your syntax. I've always used the form VK(number) so in the case of F1 it will be VK112. Also even with VK112 in the line I also need a value in the parameter after the VK for the . Try this and see what happens.

OnEvent>KEY_DOWN,VK112,0,GetDataPos
That worked, thanks. I seem to have found that in the script at the SRT end it doesn't return to wherever it was when the KEY_DOWN event happened. I had to add a Goto after the SRT end to force flow back to my loop. Is that normal behaviour or have I missed something about event traps?

Anyway, thanks very much for your help.

gdyvig
Automation Wizard
Posts: 447
Joined: Fri Jun 27, 2008 7:57 pm
Location: Seattle, WA

Post by gdyvig » Fri Apr 16, 2010 5:56 pm

Hi sjewins,

I did not need a goto after the SRT.


Gale

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts