Jump to content
Macro Express Forums

Multi-running macro experience?


Recommended Posts

I've had mixed experience with simultaneous macros. There are limitations like being able to run only one Window-on-Top (WoT) macro unless there is some intentional synchronisation. Several non-Window (Background) macros should be able to run simultaneously, limited by the processor queue.

 

I've found that Background macros run well together, although I've not tried much other than some basic testing. Where I've run into problems is with a WoT macro and busy Background macro. In particular I wrote a macro to log CPU% for a given process. Two methods; one used a modified VB script, the other used AutoIt to read the data from a Task Manager application. I was trying to log Firefox's CPU usage with one of my web page downloading macros running. I found that the disruption caused by the External Scripts running every second or so interfered with Firefox running. The logging works fine with manual web page operation. The problem may disappear with faster or multi-core CPU.

 

I was wondering what experience others had:

What sort of tasks run well together?

Effect of Background macros on WoT macros?

Effect of other applications on WoT macros?

How well do macros run with simultaneous use of time delays?

How well do macros in general work when one or more are running an External Script (internally or using Program Launch)?

Link to comment
Share on other sites

I've had mixed experience with simultaneous macros. There are limitations like being able to run only one Window-on-Top (WoT) macro unless there is some intentional synchronisation. Several non-Window (Background) macros should be able to run simultaneously, limited by the processor queue.

 

I was wondering what experience others had:

What sort of tasks run well together?

Effect of Background macros on WoT macros?

Effect of other applications on WoT macros?

How well do macros run with simultaneous use of time delays?

Well, I make one major use of simultaneous macros, and it works very well indeed.

While ME has a Wait for Keypress command, it's of limited use. I wanted (and others have expressed a similar wish) to be able to wait for any keystroke, and know what keystroke was pressed.

Accordingly I wrote a macro called KeyPress. It is passed a string of between 1 and 36 characters (0-9, A-Z) representing the keystrokes I am currently interested in, initializes the registry with several values and then calls as many macros (all identical except for the character they are comparing against) as there are characters passed in, e.g. KeyPressA, KeyPressM, KeyPressT, each of which is launched asynchronously (i.e. without waiting for it to terminate). One more macro is launched, also asynchronously, which displays a dynamically-created menu corresponding to the key presses of interest (e.g. Axxxxx, Mxxxxxx, Txxxxx).

 

The KeyPress macro then goes into a loop waiting for the relevant registry value to be set (by KeypressA, M or T) to one of these values, or one indicating the user-specified timeout (usually around 3 seconds) has occurred. The menu macro is then closed.

I have tested this with all 36 characters at the same time (i.e. 38 macros running simultaneously), and it worked flawlessly.

Link to comment
Share on other sites

You didn't say what the macros were doing other than participating in the Keypress. I'm sure I could start lots of macros but it's a question of how they interact as you push the CPU limits. That is the point at which Window-on-Top macros are likely to have problems. For example, if you are rendering video, the CPU could be pegged at 100% for a long time and then progs have to take turns.

 

Funny enough I had problems recently with key presses. What seems to be missing from ME is an "If Key Press" command (not a "Wait for" command). If you were going round a loop, at any time when the key(s) were pressed, they would be registered and the relevant action taken (such as breaking out of the Repeat, printing results so far etc). That's not too difficult to do in the Windows environment. Right now I usually initiate such actions by getting the mouse position and make the screen bottom right corner the "key press". There are other crude methods. Were that in place it could perform a multitude of functions. Is that similar to the KeyPress macro?

Link to comment
Share on other sites

You didn't say what the macros were doing other than participating in the Keypress....What seems to be missing from ME is an "If Key Press" command (not a "Wait for" command).perform a multitude of functions. Is that similar to the KeyPress macro?

Each KeyPressx macro (where x is 0-9 and A-Z) has this code:

Read Registry Value "HKEY_LOCAL_MACHINE\SOFTWARE\Insight Software Solutions\Macro Express 4\PhtData\KeyPressRepeats" into %N[1]%
Repeat Until %T[1]% Does not Equal "*"  -- The main keyPress macro resets this registry value when it's finished loading all 36 macros
 Read Registry Value "HKEY_LOCAL_MACHINE\SOFTWARE\Insight Software Solutions\Macro Express 4\PhtData\KeyPressReturned" into %T[1]%
 Delay: 20 milliseconds, without ability to halt
End Repeat
Repeat Start (Repeat %N[1]% times)
 Wait for Key Press: B  -- wait at most 1 second
 On Error
Catch Error: The condition was not met within the specified amount of time
  Read Registry Value "HKEY_LOCAL_MACHINE\SOFTWARE\Insight Software Solutions\Macro Express 4\PhtData\KeyPressReturned" into %T[1]%
  If Variable %T[1]% Does not Equal ""
	Macro Return
  End If
  Continue
End Catch Error
 End Error
 Variable Set String %T[1]% to "B"
 Write Registry Value "%T[1]%" into HKEY_LOCAL_MACHINE\SOFTWARE\Insight Software Solutions\Macro Express 4\PhtData\KeyPressReturned
 Break
End Repeat

As you can see, there are 2 loops in each of 36 macros.

The main KeyPress macro also loops KeyPressRepeats times, waiting for a value to appear in the KeyPressReturned registry value, or a timeout, whichever occurs first.

 

With all 36 macros loaded, my CPU load goes to 54% for a few seconds (dualcore CPU 2400Mhz), but the machine seems responsive.

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