Jump to content
Macro Express Forums

Wait For Various Key Press


GregChi
 Share

Recommended Posts

I have a macro that gets input for a number:

 

//Type the day & then / (auto types 06)

// DateFixer( Ctrl-Shift-/ )Starts as 01/00/00...ends as 01/xx/06

Text Type: <F2>

Text Type: <INSERT>

Text Type: <ARROW LEFT><ARROW LEFT><ARROW LEFT><ARROW LEFT><ARROW LEFT>

Wait for Text: "/"

rem: Text Type: <ARROW RIGHT>

Text Type: 06

Text Type: <INSERT>

Text Type: <ENTER>

 

<REM2:DateFixer( Ctrl-Shift-/ )><TEXTTYPE:<F2>><TEXTTYPE:<INSERT>><TEXTTYPE:<ARROW LEFT><ARROW LEFT><ARROW LEFT><ARROW LEFT><ARROW LEFT>><DIS:<BEGCLIP><DIS:<WAITKEY2:000000:000005:48><WAITTXTN2:000000:000010:/><DIS:<TEXTTYPE:<ARROW RIGHT>><TEXTTYPE:06><TEXTTYPE:<INSERT>><TEXTTYPE:<ENTER>>

 

 

If they want to exit without typing the '/', how do i write "if <esc> do something else if down arrow do something else" as choices?

Link to comment
Share on other sites

Thanks,

OK this does find either / or ESC .....

Now I need to know which it did find before the macro continues.

If I clipboard start/end copy, I capture ME cmds (<WAITTXTN2:000000:000000:/><OR><WAITKEY2:000000:000000:48>);

If I <shift>-left arrow & the '/' was pressed, the clipboard has it,

but if ESC was pressed, the macro goes berserk.

Anything else I have tried gets nothing.

What command will get the result? How do I capture what was pressed; a key or <esc>,<tab>,<alt>,<shift>?

 

 

// DateFixer( Ctrl-Shift-/ )

 

// edit cell

Text Type: <F2>

// switch to overstrike

Text Type: <INSERT>

Text Type: <ARROW LEFT><ARROW LEFT><ARROW LEFT><ARROW LEFT><ARROW LEFT>

Repeat Until %T1% <> %T1%

Clipboard Empty

Clipboard Start Copy

Wait for Text: "/"

OR

Wait for Key Press: ESC

Clipboard End Copy

 

// ??How do I capture the results here??

// ?? if not ' / ' exit macro

 

// if ' / ', finish & goto (down) to next cell

Text Type: 06

Text Type: <INSERT>

Text Type: <ENTER>

// repeat on next cell

Macro Run: DateFixer( Ctrl-Shift-/ )

Repeat Exit

Repeat End

 

CODE

 

<REM2:DateFixer( Ctrl-Shift-/ )><REM2:><REM2:edit cell><TEXTTYPE:<F2>><REM2:switch to overstrike><TEXTTYPE:<INSERT>><TEXTTYPE:<ARROW LEFT><ARROW LEFT><ARROW LEFT><ARROW LEFT><ARROW LEFT>><REP3:08:000002:000001:0001:1:01:T1><CLIPE><BEGCLIP><WAITTXTN2:000000:000000:/><OR><WAITKEY2:000000:000000:48><ENDCLIP><REM2:><REM2:??How do I capture the results here??><REM2:?? if not ' / ' exit macro><REM2:><REM2:if ' / ', finish & goto (down) to next cell ><TEXTTYPE:06><TEXTTYPE:<INSERT>><TEXTTYPE:<ENTER>><REM2:repeat on next cell><MACRUN2:DateFixer( Ctrl-Shift-/ )><EXITREP><ENDREP>

Link to comment
Share on other sites

OK If i waitfor the ESC key at the start of my macro,

 

// DateFixer( Ctrl-Shift-/ )

 

// edit cell

Text Type: <F2>

// switch to overstrike

Text Type: <INSERT>

Text Type: <ARROW LEFT><ARROW LEFT><ARROW LEFT><ARROW LEFT><ARROW LEFT>

 

waitfor the esc key here

 

Where can I find if the esc key was pressed?

Would it be captured in any variable?

the macro knows it was pressed, but I want to do something if it is pressed.

If esc clean up & exit macro, Else continue with the macro.

I can't find this 'flag'.

Link to comment
Share on other sites

Never mind, figgured it out

 

// OOo calc DateFixer( Ctrl-Shift-keypad /)

Clipboard Empty

Repeat Until %T1% <> %T1%

// edit cell [switch to overstrike (always starts as insert)]

Text Type: <F2><INSERT><ARROW LEFT><ARROW LEFT><ARROW LEFT><ARROW LEFT><ARROW LEFT>

Wait for Text: "/"

OR

Wait for Key Press: ESC

Text Type: <SHIFTD><ARROW LEFT><SHIFTU>

Clipboard Copy

Variable Set String %T1% from Clipboard

If Variable %T1% <> "/"

Text Type: <ESC><ARROW DOWN><ARROW RIGHT><ARROW UP>

Macro Stop

End If

Text Type: /06<ENTER>

// repeat on next cell

Repeat End

 

CODE

 

<REM2:OOo calc DateFixer( Ctrl-Shift-keypad /)><CLIPE><REP3:08:000002:000001:0001:1:01:T1><REM2:edit cell [switch to overstrike (always starts as insert)]><TEXTTYPE:<F2><INSERT><ARROW LEFT><ARROW LEFT><ARROW LEFT><ARROW LEFT><ARROW LEFT>><WAITTXTN2:000000:000000:/><OR><WAITKEY2:000000:000000:48><TEXTTYPE:<SHIFTD><ARROW LEFT><SHIFTU>><CLIPC><TVAR2:01:03:><IFVAR2:1:01:2:/><TEXTTYPE:<ESC><ARROW DOWN><ARROW RIGHT><ARROW UP>><MSTOP><ENDIF><TEXTTYPE:/06<ENTER>><REM2:repeat on next cell><ENDREP>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...