clyc84 Posted March 16, 2008 Report Share Posted March 16, 2008 trying to create a macro to wait for multiple key press to left click once activated, created one below but it will wait for the next key press after the first one: question: how can I let it wait for any key once x is pressed or z is pressed, meaning to go back to the start of the loop once any key is pressed. Quote Link to comment Share on other sites More sharing options...
kunkel321 Posted March 16, 2008 Report Share Posted March 16, 2008 This is a good challenge... I've been tinkering, but haven't figured it out. Let me confirm your meaning though: You want it to wait until Z *or* X is pressed--step one. If Z it pressed it clicks "here." If X is pressed it clicks "there." Either pressing Z or X completes step one. Once step one is completed any key can be pressed... Question: Once the last key is pressed, the macro stops? or it continues to loop? From you post it sounds like it continues to loop... If it continues to loop, maybe you don't need the, third, 'any' key. Just continue pressing X or Z (?) If this were the case though, you'd have to have a kill command to tell MacExp when you're done and want to stop looping. I was experimenting and tried: -Loop until T1 <>T1 -Wait for key press Z --OR- -Wait for key press X -Display text box "Z or X pressed" -End Loop. This was syntactically correct, and if I pressed either X or Z I'd get the text box, but it was a continual loop. The macro kept running until I aborted it. I then tried: -Loop until T1 <>T1 -Wait for key press Z -Display text box "Z pressed" --OR- -Wait for key press X -Display text box "X pressed" -End Loop. The debugger told me this is an incorrect use of "OR." It seems like you could capture a keypress and send it straight to a variable, then use logic to compare the variable. (If this then that) I can't see how to do this without the use of a GUI dialog box though... Maybe others have an idea. steveK Quote Link to comment Share on other sites More sharing options...
clyc84 Posted March 17, 2008 Author Report Share Posted March 17, 2008 This is a good challenge...I've been tinkering, but haven't figured it out. Let me confirm your meaning though: You want it to wait until Z *or* X is pressed--step one. If Z it pressed it clicks "here." If X is pressed it clicks "there." Either pressing Z or X completes step one. Once step one is completed any key can be pressed... Question: Once the last key is pressed, the macro stops? or it continues to loop? From you post it sounds like it continues to loop... If it continues to loop, maybe you don't need the, third, 'any' key. Just continue pressing X or Z (?) If this were the case though, you'd have to have a kill command to tell MacExp when you're done and want to stop looping. I was experimenting and tried: -Loop until T1 <>T1 -Wait for key press Z --OR- -Wait for key press X -Display text box "Z or X pressed" -End Loop. This was syntactically correct, and if I pressed either X or Z I'd get the text box, but it was a continual loop. The macro kept running until I aborted it. I then tried: -Loop until T1 <>T1 -Wait for key press Z -Display text box "Z pressed" --OR- -Wait for key press X -Display text box "X pressed" -End Loop. The debugger told me this is an incorrect use of "OR." It seems like you could capture a keypress and send it straight to a variable, then use logic to compare the variable. (If this then that) I can't see how to do this without the use of a GUI dialog box though... Maybe others have an idea. steveK Question: Once the last key is pressed, the macro stops? or it continues to loop?From you post it sounds like it continues to loop... it will continue to loop, and thats what i wanted it to be and yes my concept is to let it wait for any key press after 'Z' or 'X' or 'C' is pressed but currently after 'Z' is pressed it will wait for 'X' to be pressed, pressing on 'Z' or 'C' it will not response Question: how did u manage to run the macro with the OR operator, I am unable to even save it. Quote Link to comment Share on other sites More sharing options...
kunkel321 Posted March 22, 2008 Report Share Posted March 22, 2008 Question: how did u manage to run the macro with the OR operator, I am unable to even save it. I was surprized I was able to use the "or" command in the manner.. Here, I recreated the script: <REP3:08:000002:000001:0001:1:01:T1><WAITKEY2:000010:000000:23><OR><WAITKEY2:000010:000000:25><TBOX4:T:1:CenterCenter000278000200:000:Either X or Z has been pressed.><ENDREP> NOTE: that iit continues to keep looping and there's no was to stop it. I recommend running it from the Macro Editor so you can just hit the red 'kill' button. ...but currently after 'Z' is pressed it will wait for 'X' to be pressed, pressing on 'Z' or 'C' it will not response Yes, the macros run linearly, so for your previous setup, the bottom ones can't run untill the top ones finish... ==== It ocurrs to me that you'll need some type of macro activation. I was playing around with this script: <REP3:08:000002:000001:0001:1:01:T1><WAITKEY2:000100:000000:25><TBOX4:T:1:CenterCenter000278000200:000:You pressed "z."><ENDREP> and tried to scope it to only run in Notepad.exe and to be activated via the window title "Notepad -- Untitled." It did activate and would correctly, but I was having trouble with the scoping (i.e. it kept running even when Notepad was closed). My thought was to just have two separate macros--one waiting for "Z" and one wiating for "Y." This would avoid having to deal with the "OR" command. You might not ba able to do this though, there are rules about not having multiple macros going at the same time. What about have two separate non-looping macros that are activated with Hotkeys??? Alt-x to click 'here' Alt-z to click 'there' -steve Quote Link to comment Share on other sites More sharing options...
clyc84 Posted March 26, 2008 Author Report Share Posted March 26, 2008 I was surprized I was able to use the "or" command in the manner.. Here, I recreated the script: <REP3:08:000002:000001:0001:1:01:T1><WAITKEY2:000010:000000:23><OR><WAITKEY2:000010:000000:25><TBOX4:T:1:CenterCenter000278000200:000:Either X or Z has been pressed.><ENDREP> the script waits for either of the key but the same action will be executed, whereas I need to script it to be doing different action upon each key is pressed. My thought was to just have two separate macros--one waiting for "Z" and one wiating for "Y."This would avoid having to deal with the "OR" command. You might not ba able to do this though, there are rules about not having multiple macros going at the same time. What about have two separate non-looping macros that are activated with Hotkeys??? Alt-x to click 'here' Alt-z to click 'there' -steve I thought of that too but I will not be able to run 2 macros concurrently, I will need it to be waiting for either of the 3 keys for some time therefore need it to be looping. thanks for the advice and testing Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.