Jump to content
Macro Express Forums

Check For A Key Press?


Pinback

Recommended Posts

Is it possible to have MacroExpress 3.x "check" for the press of a particular key but not "wait" for that keypress?

 

In other words, while the macro is running I want it to check for a particular keystroke, then do something different if I press that key. But I don't want it to wait for me to press a key... the macro should continue to run normally if I'm not pressing the key in question.

 

The only thing I can find actually stops the macro and waits for a keypress... not what I'm looking for.

 

Any suggestions are appreciated!

Link to comment
Share on other sites

  • 1 month later...

Which key?

Could you "grab" the text you are typing and then type it out later?

Use Variable Set String %T1% from Prompt, analyze the characters in the variable (e.g. If Variable %T1% contains), and execute different code (e.g type %T1%, replace text or whatever)? :huh:

Variable Set to ASCII Value is very helpful for non-alphas.

<ASCIIV:1:0:1>

iceman

Link to comment
Share on other sites

What you ask is not really possible, although you may be able to achieve something approaching what you want by:

 

1) Use the Log Errors command (in the Debug category)

Set "Log Errors to File" to ON

Untick "Use Default Log File"

Type in the name of a non-existent file

Tick "Do not display error messages (log only)"

 

2) Include your command "Wait for Key Press" (BTW, you can include multiple characters by having several "Wait for Key Press" commands separated by OR, although it's rather slow)

 

There are a few problems associated with this approach:

- you still have to select a number of seconds to wait; during this time, ME will not be doing anything; and it is ONLY during this time that ME will recognize the key(s) typed in

- if the desired key presses are not typed in, your macro will abort silently after the specified number of seconds have elapsed; the only indication of this will be the existence of your specified error log file; but, unless you programatically schedule a macro to run immediately after the number of seconds has elapsed (and you can schedule only to the nearest minute) how will you ever know, and how will you restart running your macro? If you did go for the scheduled macro approach, this scheduled macro would check for the existence of the error log file and take the appropriate action.

 

This is probably not worth doing.

Link to comment
Share on other sites

this is a simple way to do what I think you want

0. in some processing loop add this section

1.periodically check for any window on top (SUCH AS VOLUME control in the system tray)

2. click on the "Volume" control and you'll pause the macro and gain keyboard

input , in this example I prompt for user action to ABORT or CONTINUE

 

// check for MACRO control input ///

If Window Title "Volume" is on top

Variable Set Integer %N5% from Prompt

If Variable %N5% = 1

Macro Stop

End If

End If // // end of check for MACRO control input

 

WHILE the macro is running, click on Volume control in the system tray,

the macro will launch the Dialog for user input

Link to comment
Share on other sites

here's a MACRO demo for the previous post

 

1. Run it: you'll be prompted to choose a folder

2. it will list one at a time, all the files in that folder and subfolders

(in a status window NOTEPAD file

 

3. while it runs, Click on the Volume control in the system tray

 

Then the Text box will give the PROMPT

1 = abort

2= continue

 

// requires file = c:\status.txt then uses it to update progress (listing folder contents)

// can use MOUSE position for break, or click VOLUME control

Activate or Launch: "status.txt" OR "status.txt"

Window Reposition: Top Left - status.txt - Notepad

Window Resize: status.txt - Notepad - (Width: 500, Height: 200)

Activate Window: "status.txt - Notepad"

Text Type: <CONTROL>a<BACKSPACE>

Text Type: start

Variable Set Integer %N1% to 0

Variable Set String %T1% from Folder Name

Repeat with Folder

Activate Window: "status.txt - Notepad"

Text Type: <CONTROL>a<BACKSPACE>

Text Type: %T2%

Variable Modify Integer: Inc (%N1%)

// / --- check --- to pause loop for user input

If Window Title "Volume" is on top

Variable Set Integer %N5% from Prompt

If Variable %N5% = 1

Macro Stop

End If

End If

// // end of check for MACRO control input

Repeat End

Activate Window: "status.txt - Notepad"

Text Type: <CONTROL>a<BACKSPACE>

Text Type: finished

counter = %N1%

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...
×
×
  • Create New...