Posts: 1,006
Threads: 330
Joined: Mar 2007
Hi Gintaras,
Is it possible to wait for either of two key presses e.g.
F5 or Enter key - either one will satisfy condition
something like
wait 10 K (VK_F5) or Y
this sample doesn't work
Thanks!
Stuart
Posts: 576
Threads: 97
Joined: Aug 2007
These Will Work
;This will work
wait 0 K (VK_F5)
;Or
wait 0 K F5
;Same code for Enter just change either F5 or (VK_F5)
Posts: 1,006
Threads: 330
Joined: Mar 2007
HI,
Thanks for posting. Problem is that this is sequential wait statements. I want either to trigger independently.
Any ideas on how to do this?
Stuart
Posts: 12,073
Threads: 140
Joined: Dec 2002
Try this
;g1
sel wait(10 K)
,case VK_F5
,case VK_RETURN
,case else goto g1
Posts: 1,006
Threads: 330
Joined: Mar 2007
Hi Gintaras,
Thanks so much for this. It occurred to me too to do it this way but I didn't know the syntax.
One thing though:
The err options seem to get in the way of the case statements:
sel wait(5 K)
err
,mes "time out"
,ret
,
,case VK_F2
,,mes "yes"
,,ret
,,;goto g2
,case VK_RETURN
,,mes "yes"
,,ret
,,;goto g2
,case else ret
Any ideas?
Thanks,
Stuart
Posts: 1,006
Threads: 330
Joined: Mar 2007
Hi Gintaras,
I know this is a big one but it will allow for so much situational awareness and robustness of macros - you never can tell what the user will do!!!!
Do you think it is possible to have a wait for any of the interactions:
Mouse-Click
KeyPress
Specific onscreen Button/element Click
and then depending on what was done, have additional macro options (like normal)
I hope this doesn't represent a limit of shell-scripting approach.
One thing is to have dialog windows be independent triggers of other functions running in parallel but it would seem better to have it all contained in one macro/function.
Thanks so much,
Stuart
Posts: 12,073
Threads: 140
Joined: Dec 2002
Quote:The err options seem to get in the way of the case statements
int vk=wait(...)
err ...
sel vk
,...
Posts: 12,073
Threads: 140
Joined: Dec 2002
Quote:Do you think it is possible to have a wait for any of the interactions:
Mouse-Click
KeyPress
Specific onscreen Button/element Click
Another way is to wait for different things in different threads.
int+ g_stopwait=0
mac "wait_for_mouse"
mac "wait_for_key"
wait 0 V g_stopwait
Function wait_for_key
Function wait_for_mouse
Posts: 1,006
Threads: 330
Joined: Mar 2007
Hi Gintaras,
I see some of this is in the Help Reference under Wait!
Sorry for not checking in their first. I look forward to playing with this and making it work.
Long live shell-scripting with QM!
Stuart