Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Wait for Either/Or key Strokes
#1
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
#2
These Will Work

Code:
Copy      Help
;This will work
wait 0 K (VK_F5)
;Or
wait 0 K F5
;Same code for Enter just change either F5 or (VK_F5)
#3
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
#4
Try this

Code:
Copy      Help
;g1
sel wait(10 K)
,case VK_F5
,case VK_RETURN
,case else goto g1
#5
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:

Code:
Copy      Help
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
#6
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
#7
Quote:The err options seem to get in the way of the case statements

int vk=wait(...)
err ...
sel vk
,...
#8
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.

Code:
Copy      Help
int+ g_stopwait=0
mac "wait_for_mouse"
mac "wait_for_key"
wait 0 V g_stopwait

Function wait_for_key
Code:
Copy      Help
wait 0 K
g_stopwait=1

Function wait_for_mouse
Code:
Copy      Help
wait 0 M
g_stopwait=1
#9
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


Forum Jump:


Users browsing this thread: 3 Guest(s)