Jump to content
Macro Express Forums

Waiting for Program closed

Recommended Posts



I launch a program with MEP, after 3-10 Minutes the program closed automaticly (not a MEP action).



How can I handle the closed window?


I think a delay of 600 seconds it's not the most time-efficient variant.



Warm regards


Link to comment
Share on other sites

I don't understand what you mean by "handle the closed window". Is your macro doing something the entire time the program is running? I seem to remember something like this in your previous posts. Let's assume this is the case for now.


First off I am not a fan of macros that run long periods of time with delays nested in repeats. I think it's better to have a macro that runs at the periodic interval from the scheduler instead. When the program's window title no longer exists it disables itself and terminates.


But if you must do it in one big loop you can do the same ting. Evaluate if the window title or a control in the program still exists and if it does self terminate.

Link to comment
Share on other sites

Where can I find the command? Under Windows/Prorams?


If you are looking for a way to activate a macro when a window closes or a process ends, you will find these options in the Script Editor under the "Activations" tab rather than under the "Script" tab. You can cause a macro to run when a window opens, closes, gains focus, etc.


Caveat: Some people have reported reliabilty or latency problems with macros triggered by window events. Activation when a window gains focus does seem to work well.

Link to comment
Share on other sites

shck you really need to explain better what it is you are doing. Is a macro running already? Are you operating in a loop? We don't know. What you're saying doesn't make sense. It sounds like you want a macro command to execute when you close Chrome. But if no macro is running no command can be executed. Remember this is not an event driven language. Only the activations are event driven. And if you do have a macro running the best you can do is use a "Wait For" command or use a loop with a delay and evaluation built in. BTW There is a Wait for Program to Terminate command.

Link to comment
Share on other sites

Maybe this script will give you an idea of how to do it.


This script is activated when Firefox closes. It displays a message, and after you click OK, the macro causes Word to open.


Make sure to examine the "Activations" tab! That's where you will find what is causing the macro to fire when Firefox closes.

Test macro.mex

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