wait for a keystroke

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
CatBreath
Junior Coder
Posts: 32
Joined: Fri Jul 08, 2005 6:12 pm

wait for a keystroke

Post by CatBreath » Thu Aug 18, 2005 1:48 pm

i want the script to work and while its working i want it to do something if a specific key or key combination is pressed.

I need the script to "wait" for the keystroke and at the same time keep working.

Can it be done?
Thanks.

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Aug 18, 2005 2:47 pm

CatBreath,

I think you can accomplish this by running multiple scripts. I know you can do it by running multiple compiled scripts (exe).

For example I have a user who has four exes running. All started by one exe. Each of the four "pastes" a different column from a csv file line when he presses either F9, F10, F11 or F12. The four exes look more or less like this:

Let>path=TEMP_DIR
Let>comma=,
Let>k=0

Label>start
Let>k=k+1
WaitKeyDown>VK122
Readln>%path%~shiplogdate~.csv,%k%,line
Separate>line,comma,var
Send Character/Text>%var_3%
Wait>.3
Press TAB
Goto>start

Hope this helps,
Dick
Last edited by JRL on Thu Aug 18, 2005 3:09 pm, edited 1 time in total.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu Aug 18, 2005 3:08 pm

Don't think you can run and wait at the same time.

WaitKeyDown> will pause the macro until a certain key is pressed. You could use a combination of these to wait for a key combination.

The only other option might be to use a Run Program with RP_WAIT=0. The Run Program would open another copy of Macro Scheduler, calling a specific script to keep running. This Run Program would be called just before WaitKeyDown>, something like this:

Code: Select all

Let>RP_WAIT=0
Run Program>C:\Program Files\MJTNET\msched c:\path\filename.scr
WaitKeyDown>~
EditIniFile>........(set a value to pause filename.scr)
Do Other Stuff.......
EditIniFile>..........(set a value to reactivate filename.scr)
This should run macro script filename.scr and wait for the tilde key (~) to be pressed before doing other stuff.
Since filename.scr is running independently, it would be running in background while first macro is wating for the tilde key.
The second macro script that is running could be doing a check for a value in an INI file.
If that value exists, then the macro could pause and loop until INI value is cleared, then continue.

This is just an untested concept at this point.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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