Jump to content
Macro Express Forums

Multiple User Environment: Timing Errors


Recommended Posts

We run ME on multiple workstations throughout the office. Each is "sharing" a copy of the same mex file, all running the same macros. Some machines are equipped with more RAM, others have less. Some machines have faster CPU speeds, others are slower.


When macros are played back on the various computers, they have timing errors - but in different places from one computer to the next. (Timing errors we most commonly experience are: _____ window did not appear; text typed too fast; typing text before program is ready, etc.) This has been a nightmare because some of the macros have hundreds of steps, using multiple 3rd party software programs - with delay points throughout the script(s).


Without spending hours on each machine - tweaking "their version" of the main mex file so it runs on their computer, the rollout of new macros and/or updates is near impossible. I worry that if everyone links to ONE mex file on the server, every computer (except the one the macro was written on) will have the same timing problems. I can't really find anything on the forum regarding this so I hope it's not an "ID10T" error I'm having. :)


Does anyone have suggestions to prevent/fix these timing errors, considering the environments will always be different (RAM, CPU speed etc.)? I am open for ANY suggestions.


Note: we never "capture" macros with mouse movements etc. All of our macros are written utilizing the direct/script editor. Thanks in advance for your help!

Link to comment
Share on other sites

I suspect that many people experience the same issues. Here are some suggestions.


The easiest to resolve is the 'text typed too fast'. You can use the Keystroke Speed command to control the speed of Text Type commands. But, as you point out, since the speed of each computer varies, this is not practical. You can control the speed of the Text Type for each individual computer using the 'Use Text Type delay' in the preferences (Options, Preferences, Delays). For slower computers set the delay to a higher value. For faster computers set it lower.


When your macro has typed a lot of text it is a good idea to use the Wait for Text and/or Wait for Text Playback commands. This will cause the macro to wait until the text has been recognized by the application.


When using the Wait For Window Title command the amount of time that you wait is the 'maximum' amount of time so, in most cases it is safe to put values in that are long enough to accomodate the slowest and/or busiest computer. Suppose, for example, that you set 'Wait a Maximum of' to 1 Minute and 30 seconds. A slower computer may take one minute for the application to load and the window to appear. On a faster computer it may take 10 seconds. On the faster computer the macro will continue in 10 seconds while the slower one will wait for a minute.


With many applications waiting for the window title to appear is not enough. Sometimes the window appears but the application is not yet ready to accept input. The Delay commands are handy in these cases. You may find that a specific amount of delay is appropriate for all of your computers. For example, Delay 1.25 Seconds. On the other hand you may need a longer delay for slower computers. I recommend that you use use variables in the Delay commands. In other words, use Delay %D1% Seconds instead of Delay 1.25 Seconds. You will need to put a Variable Set Decimal command near the top of your macro to set the amount of delay to use. When you need to increase or decrease the amount of delay you only need to change the delay time or times in one place.


If you use variables for the delay times, you can then save the delay times in files or the registry on each individual computer. Instead of using the Variable Set Decimal command to set the delay the macro would read the value from the registry or a file and set the decimal variable (%D1%) for you. If you choose to use this technique you will need to write a macro that allows you to set the amount of time(s) to delay and run that macro on each individual computer.


If saving delay times is not practical, you could add macro commands that determine which computer is running and adjust the delay times accordingly. The Variable Set From Misc / Set Variable to "Name of Machine" will return the specific name of the machine. Another approach would be to read the CPU and Speed from the Windows Registry. On my machine this is found at


One last thing to note: Before I write a macro I always decide whether reliability or optimization is the most important. Most times I choose reliability over the most optimized speed. Remember that even a fast computer gets slow at times. When I write a macro and discover that it works with a delay of one tenth of a second (Delay 0.10) but it doesn't work with a shorter delay, I will increase the delay to something like 0.2 or 0.25.

Link to comment
Share on other sites

This is very helpful information. I really appreciate your reply.


I guess our biggest problem is that we didn't consider "reliability vs. optimization" in the inconsistent environments we operate under. We were more focused on making the macros run as quickly as possible to save as much time as possible for the end user. This obvioulsy has caused an even bigger slow-down by reducing reliability in operation.


It appears that a number of these solutions will still require modifications on the individual computers. We're looking at a potential work environment of over 100 computers in the next 6-12 months. Small changes seem impossible on such a large scale with our limited support staff. We will try to modify some of the "global" timing settings and see if this works for our immediate needs.


I am still very open to additional ideas or other "fixes" to remedy multi-user timing problems like we're experiencing. Please post if you've encountered similar issues and how you've been able to get around them.


Thanks again Kevin.

Link to comment
Share on other sites



Even though you have (or will have) over 100 computers, I would guess that you will have a managable number of 'different' computers. If you have 10 or 15 different types of computers then you could adjust the delays for each type.


What I would do is create a macro to set the delay value(s). The macro would read from the registry to determine the type and speed of the CPU and then set the delays longer or shorter as required. Then place a Macro Run command at the top of your main macro to set the delay value(s).


I say 'value(s)' because you may decide that you need several different delays. I normally use between 1 and 3 different delay values and put them in D1, D2 and D3. Where a short delay is needed the macro uses D1. D2 provides a longer delay and D3 a still longer delay.


Your reply got me thinking about another possible solution. You could have a macro that runs a test to determine how long the delays should be. Write the result into registry (on the local computer) or into a file (again on the local computer). If the registry value or file does not exist then you would automatically run the speed detection macro. It might work something like this:


- Read saved delays.

- If saved delays exist then exit.


- Get the current time (including seconds)

- Load an application

- Wait for the window to appear

- Look for some other indication that the application is ready

- Get the current time

- Determine the difference between the start and end times

- Use that difference to determine how fast the computer is and, consequently, how to set the delay value(s)


The speed test would normally only be run once. However, you might want to have the ability to run it again on demand to re-detect the speed.

Link to comment
Share on other sites

Your reply got me thinking about another possible solution. You could have a macro that runs a test to determine how long the delays should be. Write the result into registry (on the local computer) or into a file (again on the local computer). If the registry value or file does not exist then you would automatically run the speed detection macro. It might work something like this:

Just wanted to say that I think this is a brilliant idea. Kudos!


... Floyd, get over here ... take a look at this ... yeah ... yeah ... uh-uh ... what do ya mean I SHOULD of thought of it?? What am I paying you for? Uhm scuze us folks ... Floyd ... Floyd ... not paying WHO enough? Wait ... ah gotta go ...

Link to comment
Share on other sites

Wow. You're a freaking genius Kevin. Really. I would never have thought of this dynamic solution. It'll obviously take some tweaking, but I don't see why this wouldn't fix our problem.


Brainstorming this solution, I just thought about a fix along these same lines. A dialog could prompt to modify a variable that would set the Macro Playback speed factor placed at the beginning of every macro. All I'd need to do is save the variable(s) to mem, and restore values prior to each macro. Could this work?


I haven't tried it yet so I don't know if the playback factor can even be set as a "N" or "D" variable. If this does work, it could be a lot quicker/easier mod than going through and changing every timed delay to a "D" type variable. My end users could then adjust their personal macro speed on the fly without bugging me.


ME doesn't hold variables after comp restart does it? Is that why you write it to the registry? I need to learn more about how to do this.



Link to comment
Share on other sites

Yes, you could use th Macro Playback Speed: %D1% command at the top of each macro. This command affects the delays throughout the macro. If your macro does not have any delay commands then this command will not have any (or very much) effect.


Yes, you could have the user enter a value for their playback speed. But do you really want the users to have to do this?


Each time Macro Express runs, all variables are initialized to default values. From your description I think the best approach is to save the variables in the registry or in a file.

Link to comment
Share on other sites

  • 9 months later...

Is there a way to determine the speeds (i.e. Macro, Keystroke, and Mouse Speed) a macro is running at? :huh:


Based on the content of this Topic, I chose to post my question here. :unsure:


I have macros I'd like change speeds for temporarily, and then restore to the prior speeds.


I looked through the various Variable Set commands (i.e. Variable Set String, Integer, Decimal, and From Misc) and could not find an option to "Set Value from " any of the speeds listed above. (Request a Feature?)

I also didn't find any changes to the registry after changing speeds.


My guess is the answer is no, and I'll end up using one of the previously suggested solutions. :D

save ... in files or the registry

I could also hold the values in other variables (e.g. Copy D99 to D98, and then back to reset). Following is my "speed" changer:

<REM2:SpeedSet-MacD99-KeyN99><REM2:Set program speed.><IFVAR2:3:99:1:0><DVAR2:99:01:1><ENDIF><SPEED:%D99%><REM2:Set keyboard speed.><SPKEY:%N99%>

I agree with Brad:

Wow. You're a ... genius Kevin.

The following will prove invaluable: :D

When your macro has typed a lot of text it is a good idea to use the Wait for Text and/or Wait for Text Playback commands. This will cause the macro to wait until the text has been recognized by the application.



Link to comment
Share on other sites

Kevin's sugggestion is excellent. Bearing in mind Kevin's earlier comment "Remember that even a fast computer gets slow at times.", may I suggest adding a "fudge" factor to allow for this possibility. For example, if you determine that Machine X requires a minimum delay of 1 second for a particular (type of) operation, then make that delay something like 2 seconds instead. Obviously, if a delay of 60 seconds is needed, you wouldn't necessarily make that 120 seconds - perhaps 80 would do!

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...