pepanee Posted March 11, 2015 Report Share Posted March 11, 2015 Hi, I was trying to look for an option in Macro Express or try some macros to attempt this, yet cannot find any solution. So I have Macro #1 running to repeat something 10 times. Yet there are times when I no longer care about letting this macro complete the 10 repetitions it has to make. I would like to start Macro #2 when Macro #1 is six repetitions through. Once I start Macro #2, this would forcefully stop Macro #1 and begin Macro #2. I set the 'Pause' button to abort any running macro, and that's pretty cool and works effectively, yet I want to cut out this middle man at times: Like I could start Macro #1, press Pause to stop this macro, then start Macro #2. But I actually want some option to where: I start Macro #1. While Macro #1 is still running, I want to start Macro #2. The initiation of Macro #2 would tell any previously running macro to stop, then let Macro #2 to run all by itself. How can I do this? Thanks Quote Link to comment Share on other sites More sharing options...
Cory Posted March 11, 2015 Report Share Posted March 11, 2015 First off there's no way stop a macro from another. MEP is not designed to work that way. You need to think in terms of having a macro terminate itself. For instance one could be running and check periodically for a registry value to change. When the registry value changes it aborts itself. Then the other macro can change that value in effect commanding the first macro to self terminate. You can also have one macro as a master to control when other macros run. Again using the registry can be handy to allow them to communicate. The other advice I have is not to let macros run a long time. It sounds like this is the case here an IMHO it's a bad practice to have a repeat with big delays. It sounds like that might be what you're doing here. It's better to run the macro on a schedule. EG remove the 1 minute delay in a loop and have the macro scheduled to run every minute. Then another macro activates and deactivates it as needed. I just think it is a bad practice to let macros run a long time and wait. Also you can effect a loop externally. When the control macro fires it can change a registry value to 10 and each time the other macro run it decrements that value. Things like that. Quote Link to comment Share on other sites More sharing options...
terrypin Posted March 11, 2015 Report Share Posted March 11, 2015 Maybe you could try using the command If Clipboard Equals "Stop" Both (or several) macros could access the clipboard to decide appropriate action. The same approach could be used with the tests made on a text file or registry key. Or to stop all macros, you could use the Move Mouse to Tray Icon, and specify the green man icon with "Macro Express Pro - Macros currently running". Then start whatever macro you want next. Quote Link to comment Share on other sites More sharing options...
pepanee Posted March 11, 2015 Author Report Share Posted March 11, 2015 Cory: Whenever I run the macros, I am physically here at the computer observing and verifying that the macros are on task and not trailing off doing their own thing. So no worries about them running for long periods of time. There's also another example for a different macro that I have which locates and selects a certain music file in File Explorer (Windows 8.1) that's playing in Winamp. Yet at rare times, File Explorer tends to slightly lag a little bit, where the macro gets stuck halfway through the macro and doesn't reach its end result. This causes the green running man in the taskbar to stay active waiting and stuck. I prefer to keep he macro script exactly the way it is, and not change anything I wanted it to do. Assuming the macro gets stuck, I want to run it again to where this previous macro would terminate and this new attempt of it takes over. So in summation and simplicity: • I want the option of whenever attempting to run any macro, using a keyboard shortcut, to terminate any previously running macro and start this new macro. terrypin: Give me an example of what you mean by the clipboard = stop. Yet also, the program I use runs full screen, so having the mouse go to the taskbar and click the green running man is no longer an option. It actually sounded pretty cool and would work, yet I remembered the program I use takes the whole screen. Thanks for that suggestion though. Thanks again guys Quote Link to comment Share on other sites More sharing options...
Cory Posted March 11, 2015 Report Share Posted March 11, 2015 Well good luck with that. There is no command to terminate another macro. Quote Link to comment Share on other sites More sharing options...
Samrae Posted March 11, 2015 Report Share Posted March 11, 2015 pepanee, are you aware of the HotKey that can abort your macros? By default this is Scroll Lock + Pause. You can change it by clicking Options, Preferences, Playback and then the Miscellaneous tab. This will abort all running macros. I do not know whether or not you can put the abort macros hotkey in a macro. I would think that if you did it would abort the new macro that is running also. I don't have time right now to test that. The suggestions from Cory and terrypin are similar. You can have your second macro place something on the computer somewhere that the first macro looks for and halt if it finds it (Macro Stop). Cory says to write something to the registry. Terry says to copy something to the clipboard. You could also write to a file. There are macro commands to write to any of these locations and other macro commands to read from them. However, it might just be easier to manually press Scroll Lock + Pause just prior to starting your second macro. Quote Link to comment Share on other sites More sharing options...
rberq Posted March 11, 2015 Report Share Posted March 11, 2015 I think you will have to do as Samrae says, use Pause to kill the running macro. Suggestions others have made, to have the macro kill itself based on a registry or file or variable flag, are fine and are suitable for many situations. But if your macro has called on File Explorer to do something, and Explorer does not return control to the macro, then the macro can't kill itself because it is not in control. Quote Link to comment Share on other sites More sharing options...
pepanee Posted March 12, 2015 Author Report Share Posted March 12, 2015 Why can't there be a 'second-order' version of aborting a macro? So an option where that [the launch attempt of any macro will forcefully end any currently running macro, if any are running.] (that's the best way to put it in words) I need something like that. Can the programmers implement that feature in there? I am aware of the key I set to abort macros (the Pause key), but like I stated above, i want to cut out this middle man. I actually did try to abort the running macros in the beginning of any macro, and that just ends the newly-runned macro immediately. Quote Link to comment Share on other sites More sharing options...
rberq Posted March 12, 2015 Report Share Posted March 12, 2015 Why can't there be ... There COULD be any number of features. But how complex do we need ME to be, simply to handle situations that don't commonly occur? I'm thankful it does all that it does, and you can program around these oddball situations. Quote Link to comment Share on other sites More sharing options...
pepanee Posted March 13, 2015 Author Report Share Posted March 13, 2015 Thanks for all the replies, and I apologize for not mentioning a reply to the suggestions that I wasn't able to understand, so if you're reading this and you had a suggestion that I didn't respond about directly, then please help me understand what you're talking about. I really do appreciate this program, Macro Express; it's a really simple and useful program to do the functions its supposed to and has many in-depth variations of different tasks it can execute. This program is much appreciated and I thank you Invision/Insight/Wintools for this product. It's a one of its kind, compared to the majority of other macro programs. But also, if any of the programmers are reading this, I hope that in the next release, you can include an option: • When attempting to run a macro, forcefully end any previously running macro, and initiate this new macro to run. That is the best, most simplest way that I can sum up my whole idea into (the line right above this). Thanks Quote Link to comment Share on other sites More sharing options...
terrypin Posted March 13, 2015 Report Share Posted March 13, 2015 It seems to me so easy to do manually, at least if you're activating the new macro with a hotkey or mouse event. I would tap Pause+Scroll Lock to stop any running macros, immediately followed by say Ctrl+F12 to start the new macro. Less than a second to accomplish, only fractionally longer than the single hotkey takes. Note: Some macros can't be stopped. For example I have a hotkey activated macro that rings a bell after five minutes to tell me when to remove the tea bag from a brew I've brought to my desk. It contains the Wait for Time to Elapse command, which cannot be terminated by any of the usual methods. Nor would I want it to, as I continue to run or edit other macros. -------------------- If you really are determined to automate it, here's one inelegant way I found to do so.I set up a macro called 'Schedule as required', activated using Scheduled > Once (initially at any time on any date). That macro has just one command, a Macro Run which runs your new macro, which I called 'Solo macro'. In fact, on reflection, a better name than 'Schedule as required' would be 'Solo macro starter'.I then wrote another macro called 'Edit ScheduleAsRequired'. When run (from your starting macro, the one you want to close) it opens up MX Explorer, and edits the macro 'Schedule as required', setting a Date of Today and a Time of 00:01, and enabling the option 'If the activation was missed, run at the next available time'. As soon as that revised macro is saved, 'Solo macro' is run.The slowest part of the operation, 2 or 3 seconds here, is opening up MX Explorer (assuming it's currently iconised in the tray). I had to apply a couple of pixel colour tests to ensure that it was fully ready for the subsequent navigation to 'Schedule as required'. Note: It would be good if MX Pro allowed the use of variables in setting the schedule. I'll consider a feature request. Quote Link to comment Share on other sites More sharing options...
mark_miller66@bellsouth.ne Posted March 18, 2015 Report Share Posted March 18, 2015 Here is an example 'running' macro where the routine is move 5 pixels repeatedly every 3 seconds unless the registry key 'stopmacro' exists. If the registry key stopmacro exists, the key will be deleted (so that it can be re-created in the future by the 'stopper' macro) <REPEAT UNTIL Variable="%macro%" Condition="\x00" Value="-12"/> <IF REGISTRY Key="TRUE" Exists="TRUE" Path="HKEY_CURRENT_USER\\Software\\Insight Software Solutions\\Macro Express 4\\Miscellaneous\\stopmacro\\"/> <DELETE REGISTRY KEY Key="HKEY_CURRENT_USER\\Software\\Insight Software Solutions\\Macro Express 4\\Miscellaneous\\stopmacro\\" _IGNORE="0x0022" _IGNORE="0x0023"/> <MACRO STOP/> <END IF/> <MOUSE MOVE Option="\x03" X="5" Y="1" _PROMPT="0x000A"/> <DELAY Flags="\x01" Time="3"/> <END REPEAT/> here is an example 'stopper' macro, the first line creates the registry key 'stopmacro' and then you can put whatever else you want afterwards: <CREATE REGISTRY KEY Key="HKEY_CURRENT_USER\\Software\\Insight Software Solutions\\Macro Express 4\\Miscellaneous\\stopmacro" _IGNORE="0x0022" _IGNORE="0x0023"/> Quote Link to comment Share on other sites More sharing options...
pepanee Posted March 19, 2015 Author Report Share Posted March 19, 2015 Thanks for the replies, yet those methods don't work exactly the way that I wanted it to work. I just hope in the future release, this option will exist (the one I stated in reply #10 above). Quote Link to comment Share on other sites More sharing options...
mark_miller66@bellsouth.ne Posted March 20, 2015 Report Share Posted March 20, 2015 I have found batch file shut down and restart an alternative that works even if MacroExpress is locked up...Search the forum thread: how to kill a macro without clicking on green icon?started by stackexchange (worth a view just for a view of stackexchange) Quote Link to comment Share on other sites More sharing options...
terrypin Posted March 20, 2015 Report Share Posted March 20, 2015 But more than a close and restart of MX is needed. Hence the suggested method I described in post #11. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.