WaitKeyDown Problem

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
Willaim Mitchell
Newbie
Posts: 6
Joined: Sun Nov 18, 2007 8:23 pm

WaitKeyDown Problem

Post by Willaim Mitchell » Mon Nov 19, 2007 2:40 am

I have a minor problem with a script using WaitKeyDown. The ESCAPE key is recognized but only if I hold the key down long enough to activate the character repeat. It might be missing characters or it might be a timing problem. The keyboard is part of a Dell wireless desktop running MS XP Home.

e.g.
LClick
WaitWindowOpen>Command Prompt (3)
MoveWindow>Command Prompt (3),722,39
.
.
.
Send>b
WaitKeyDown>VK27
send>n

The program running in the Command window is an old DOS application and all other Macro Scheduler 9.2 key functions work as expected with it. Has anyone else noticed unexpected results when using WaitKeyDown?

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

Post by Marcus Tettmar » Mon Nov 19, 2007 9:09 am

Your script may have a tight or intensive loop in it, or maybe waiting for some other event to take place, thus delaying detection of the keystroke. If you post your full script we may be able to help you optimise it.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

Willaim Mitchell
Newbie
Posts: 6
Joined: Sun Nov 18, 2007 8:23 pm

Post by Willaim Mitchell » Wed Nov 21, 2007 6:44 am

Full Script:
// C:\Program Files\MJT Net Ltd\Macro Scheduler\Frac.scp
// Recorded on Wednesday, November 15, 2006, at 09:10 AM

//Recorded Events
Let>WW_TIMEOUT=5
CapsOff
MouseMove>265,1181
Wait>1.0
LClick
WaitWindowOpen>Command Prompt (3)
MoveWindow>Command Prompt (3),722,39
ResizeWindow>Command Prompt (3),833,993
Wait>1.00
Send>f
Wait>0.5
Press Enter
Wait>1.5
Send>2
Wait>0.5
Press Enter
Wait>1.00
Send>5
Wait>0.50
Press Enter
Wait>1.0
Send>b
WaitKeyDown>VK27
send>n
//Press Enter
Wait>0.10
Send>n
Wait>0.20
//Press Enter
Wait>0.10
Send>n
Wait>0.20
//Press Enter
Wait>0.10
Send>n
Wait>0.20
Press Enter
Wait>0.10
Press Enter
Wait>0.10
Press Enter
Wait>0.10
Send>e
Wait>0.20
Send>x
Wait>0.20
Send>i
Wait>0.20
Send>t
Wait>0.20
Press Enter

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

Post by Marcus Tettmar » Wed Nov 21, 2007 11:44 am

The only reason I can see for a delay here is if you are pressing Escape before the script has got to the WaitKeyDown line. Once the script is at that line there should be no delay because there is no other wait.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

Willaim Mitchell
Newbie
Posts: 6
Joined: Sun Nov 18, 2007 8:23 pm

Post by Willaim Mitchell » Thu Nov 22, 2007 3:47 pm

Right. No Delay and several minutes between Send>b and
WaitKeyDown>VK27. Has anyone else used WaitKeyDown with wireless keyboard drivers? In an XP Command Prompt environment with a running program?
I have noticed I can tap quickly on the ESCAPE key and the running program will react but not always Macro Scheduler. It seems to need a longer keypress.

Willaim Mitchell
Newbie
Posts: 6
Joined: Sun Nov 18, 2007 8:23 pm

Post by Willaim Mitchell » Wed Feb 06, 2008 9:05 pm

I just upgraded to Macro Scheduler Home Ver. 10 and the WaitKeyDown problem went away. If nothing was changed in this function then the same interpreted script now runs a bit faster than in Ver. 9.

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