Jump to content
Macro Express Forums


Recommended Posts



2 issues - 


1.  In my macro I put in a delay before I refresh a page. 

Currently I put in a single integer variable that is prompted for

a value when the macro runs... ie. "How many seconds between refresh?"  I enter 15 seconds

Is is possible to put a range for this answer?  I would like to enter 10-20 seconds for an answer

and then the macro would select a random number between 10-20 seconds  (more human like)

Can this be done?


2.  EVERY time I create a macro I put in a delay after EVERY command.  ie.


delay.33 seconds


delay.33 seconds

Activate window

delay.33 seconds


I have found that it is necessary in order for the macro to not trip over itself.

I have been using macro express for 20 years now and have been doing this the entire time.

The macros work but I would love to not have twice as many lines of code.


Thanks in advance


Link to comment
Share on other sites

You might consider writing two posts when you have 2 unrelated questions in the future. 


1- Why don't you type "10 20" in the prompt as string and split it on the space?


2- The only time you should need a delay is when the program you're working with takes time to respond. I don't use delays like that. Maybe you could create a dem macro using Notepad for us. 

Also if you use controls or other such things to control timing you will not waste time performing the maximum delay each time. It's rare I ever have a delay like that. Even if there are no controls I can use, I'll check a pixel color or something. 

Link to comment
Share on other sites

Nothing wrong with delays. I frequently insert delays between steps when I'm first building a macro. But as I refine a script, I usually find I can reduce and delete delays. Sometimes the final script has one or two delays. Often there are no delays in the final script.


Once in a blue moon, I discover that a delay must be quite long for a macro to work, e.g., a second. But that's rare.


Sometimes I deliberately include longish delays because I want to see what's going on as the macro is running.

Link to comment
Share on other sites

From your examples, a delay after Activate Window might be needed, but probably not.  Anywhere that the macro has to wait for Windows or an application to react, may require a delay.  But sometimes the delay is implied by the command, such as Wait for Web Page, in which case you should not need to explicitly code a delay command.   


Delays after Text Type should rarely be needed.  Use the command Keystroke Speed if the typing outruns the ability of Windows or the application to accept keystrokes. 

I insert "Keystroke Speed: 30 milliseconds" at the beginning of most macros, as a default. 


Delays should never be needed after most "routine"  or "internal" macro commands, like setting or modifying variables, logic commands, and so on.  Not only are you working harder than necessary, inserting all those delays, but your macros must run excruciatingly slowly. 


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.

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.

  • Create New...