Pressing ESC won't trigger Subroutine DoExit.
Please help. Thanks.
Code: Select all
OnEvent>KEY_DOWN,VK_ESCAPE,0,DoExit
Let>k=1
While>k<1000>Ok
Wait>.5
Endwhile
SRT>DoExit
Exit
END>DoExit
Moderators: JRL, Dorian (MJT support)
Code: Select all
OnEvent>KEY_DOWN,VK_ESCAPE,0,DoExit
Let>k=1
While>k<1000>Ok
Wait>.5
Endwhile
SRT>DoExit
Exit
END>DoExit
Emphasis mine.WaitKeyDown pauses execution until the specified key is pressed. For an ordinary character key specifiy the character of the key. For other keys use the virtual key code preceeded by VK:
...
WaitKeyDown>VK101 - waits for virtual key code 101 (Numpad 5) to be pressed.
Not that much imagination required actually... as long as you remember... the Help File is your friend.armsys wrote:Nonetheless, it still requires some imagination to translate between Microsoft's VK list and the actual coding in Macro Scheduler. Your last post leaks the missing link.
For example, in both http://msdn.microsoft.com/en-us/library/dd375731 and http://www.mjtnet.com/vkcodes.htm, Esc is expressed as VK_ESCAPE. In actual Macro Scheduler scirpt, it should code as VK27.
As you can see, the code example uses VK32 while in the sources you mention, its called VK_SPACE.Help File entry for OnEvent wrote:OnEvent
OnEvent>EventType,EventParm,ExtraParm,Subroutine
Not supported in Macro Scheduler Lite.
Establishes an event handler. When the event occurs the script branches to the specified Subroutine.
...
Tons of good stuff here, please read the actual Help File, it will help... honest
...
Example
OnEvent>WINDOW_OPEN,Notepad*,2,DoNotepad
OnEvent>WINDOW_NOTOPEN,Notepad*,2,DoNotepadNotOpen
OnEvent>WINDOW_NEWACTIVE,0,0,DoNewWindow
OnEvent>KEY_DOWN,VK32,3,KeyPress
Label>start
Wait>1
If>NotepadOpen=1
Message>Notepad is open
Else
Message>Notepad is not open
Endif
Goto>start
SRT>DoNotepad
Let>NotepadOpen=1
END>DoNotepad
SRT>DoNewWindow
GetActiveWindow>title,x,y
MessageModal>New window: %title%
END>DoNewWindow
SRT>DoNotepadNotOpen
Let>NotepadOpen=0
END>DoNotepadNotOpen
SRT>KeyPress
MessageModal>ALT+Space was pressed
END>KeyPress
mtettmar wrote:Secret? Here's what the help file says:
Emphasis mine.WaitKeyDown pauses execution until the specified key is pressed. For an ordinary character key specifiy the character of the key. For other keys use the virtual key code preceeded by VK:
...
WaitKeyDown>VK101 - waits for virtual key code 101 (Numpad 5) to be pressed.
Then it links to the page you quote which shows for VK_ESCAPE:
VK_ESCAPE (27)
ESC key
So the number you need to put after VK is 27.
So not really a secret