Jump to content
Macro Express Forums

Priority Of Macros


Lars_Sandberg
 Share

Recommended Posts

Hi, how can I prioritize macros if possible? I'm using ME 3.5b.

I made 2 macros both with hotkeys CRTL-ALT-W.

 

The first one is for closing all windows/ instances of Internet Explorer, with scope IE running.

 

The other macro works only within a CAD system (Autodesk Inventor) for closing all windows. The scope for that macro is that the Inventor window is on top.

 

The strange thing is that if both IE is running as well as Inventor, where Inventor is on top, then IE closes windows when I hit CRTL-ALT-W

In my logic, macros related to the topmost window/ application should have first priority??

 

Can someone explain how to deal with prioritizing macros if possible

 

regards Lars

Link to comment
Share on other sites

Do you have the 'Run If On Top' option checked in the Scope for the IE macro? If not, this may help.

 

If the scope conditions are met for two different macros, the macro that runs is the first one in the macro file. In other words, the one that was created first. There is no option to allow the macros to be sorted by creation date so there is no way to predict which macro will run.

 

If you cannot set the scope of your IE macro to 'Run If On Top' then you may want to add something like this to your IE macro:

 

If Window Title "Inventor" is on top
 Macro Run: Inventor
 Macro Return
End If
   .
   .
remainder of macro

Link to comment
Share on other sites

I'll leave Kevin to the main question. I wondered if it is either alphanumeric order(Explorer), sort order or macro scope order.

 

A method of controlling a number of applications is to to make a Global "control" macro operating the suite of macros run by the hotkey, simplified:

 

If prog A running

Macro Run prog A macro (A is 1st priority)

macro stop

 

Else

If prog B running

Macro Run prog B macro (B is 2nd priority)

macro stop

End If

 

Else

If prog C running

Macro Run prog C macro

End If

 

End If

 

Substitute "If prog running" line for whatever is applicable to identify the application and condition. The prog A, B, C macros can be set to "no activation" but should still be set for the particular application scope. I have not tried this method out!

Link to comment
Share on other sites

I edited my IE "close all" macro, so it had the newest date, but that didn't help. The IE macro still had priority above my Inventor macro despite Inventor was on top.

The macro that runs is the first one that was created, not the last (or first) modified. You might be able to adjust this by creating a new, blank, macro file and exporting/importing your macros making sure to import the one you want to have priority before the other macro. But we do not guarantee that this will work. And, you might get it working only to have it change sometime later (if the macro file was recreated or copied from a backup).

 

Macro Express uses the first allowed macro method to reduce the amount of processing necessary to launch a macro. A routine to determine which window has focus and give priority to the macro(s) that match would slow down all macro activations.

 

no IE, 'Run If On Top' isn't tagged on, since many IE instances can be minimized.

Yes, but you could have the 'activation' set to only run if the window that has focus is IE ('Run If On Top'). The scope will not affect how the macro runs once it is activated. It will still be able to close all your IE windows. The only difference is that the macro would not start unless at least one IE window had focus.

 

If you do not wish to only activate the macro if an IE window has focus, then the code sample I provided or the main macro Noggin the Nod suggested should work.

 

There is one more possibility. If you want your Win+Alt+W macro that closes all IE windows to run even when the window that has focus is not an IE window, then you could set the scope for that macro to 'Global'. Global macros have a lower priority than other 'scoped' macros.

Link to comment
Share on other sites

I know that the code suggested by Noggin the Nod will work because I use that technique for my password macros. Rather than having to remember a different hotkey for every application, I have one hotkey to enter my password or other login information. When I press F3 the macro looks to see which application has focus and sends the appropriate login/password.

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