johnh2005 Posted July 27, 2009 Report Share Posted July 27, 2009 Hello, and thank you in advance for any help with this. I am using macro express pro. I am attempting to create a macro to run a series of simulated button presses on a timed schedule. When I start a certain program I want to be able to do this: Press Control + Alt + Shfit + S to start the macro running. Simulate the button press of the number 1 key every 1 minute and 2 seconds. Simulate the number 2 every minute and 15 seconds. Somulate the number 3 every minute and 23 seconds. Press Control + Alt + Shift + P to stop the macro from running. I have attempted this several times looking at the tutorials and watching the videos however, the videos appear to be of a different version than I am running or I do not know how to get to where they are starting. I am BRAND NEW at running macros and have no exp setting them up so I will need a detailed setup step by step or a link to a download that I can edit to work with my program name. I would like for this to run in that program while I am alt tabbed out to another program. If this cannot be done then I will accept just being able to do it while that program is on top. Thank you for your help in this matter! JH Quote Link to comment Share on other sites More sharing options...
Cory Posted July 27, 2009 Report Share Posted July 27, 2009 Please clarify the 123 button push schedule. Are you saying you want to execute one macro and have all of the numbers being entered simultaneously? IE the schedule starting from noon would look like: 12:01:02 1 12:02:04 1 12:02:15 2 12:03:06 1 12:03:23 3 12:04:08 1 12:04:30 2 12:05:10 1 12:06:12 1 Please confirm before I spend time writing up some ideas. Quote Link to comment Share on other sites More sharing options...
Cory Posted July 27, 2009 Report Share Posted July 27, 2009 There are a couple of ways to enter text to that program while you work on others Warn the user with a beep, lock the keyboard and mouse, bring the program on top, enter the number, and return to the previous window. I think this would be extremely annoying. If the program has controls you can send test to the control. The nice thing here is it not only doesn’t have to be on top and focused it doesn’t even have to be visible. But many apps like web apps do not have controls that are useful for this. See you help file about using Windows Controls. I believe there is also a sample macro about using controls in the samples MEX file that installed with your app that demonstrate using MS Calculator. Use a VM (Virtual Machine). This sounds like a bit of an extreme measure and I have only recently started experimenting with this but it works brilliantly, is free, and is a lot simpler than it sounds. Essentially you create a VM on your machine using free software like Virtual PC from MS or VMWare. With this you can create machines that run inside the VM software. Visualize having a windowed application and in it is an instance of Windows XP doing your dirty work. Here is my new thinking on the matter. There are two types of macros as I see it, those that aid user GUI productivity and those to perform automated tasks. And unless the automated task does not require use of the GUI you really want another machine to run it on so it does not make you unproductive on your workstation. With the VM you can have that without the cost of another machine. And they’re cool because you can simply turn them on and off without boot time and they do everything your machine can do. Oh, and you can minimize them or disconnect in a way to still see the GUI without having your mouse and keyboard interfere. I do a lot of macros that go and enter tons of data into web pages and it’s so cool to be able to fire it off and leave it windowed where I can monitor it while I go back to working on my workstation as per normal. It's a perfect match for MEP I think. Quote Link to comment Share on other sites More sharing options...
johnh2005 Posted July 27, 2009 Author Report Share Posted July 27, 2009 Please clarify the 123 button push schedule. Are you saying you want to execute one macro and have all of the numbers being entered simultaneously? IE the schedule starting from noon would look like:12:01:02 1 12:02:04 1 12:02:15 2 12:03:06 1 12:03:23 3 12:04:08 1 12:04:30 2 12:05:10 1 12:06:12 1 Please confirm before I spend time writing up some ideas. Yes, this exactly what I want it to do. I can leave the application running and on top if needed. I probably would not be able to set up a virtual machine so lets leave that out for now. I want to start the program. Once it is up and running hit a "hot key"(I think) to start the macro running. Then have it run until I press a "hot key" and have it stop running. You have the schedule exactly right. Quote Link to comment Share on other sites More sharing options...
Cory Posted July 27, 2009 Report Share Posted July 27, 2009 This is actually not as simple as it may seem. MEP is procedural so having one macro to do it all would result in some really tricky logic. If it were me I would avoid that and create multiple macros to accomplish the task but in that I see a couple of ways and it would depend on how sensitive you are about the timing. Consider these two scenarios. Create 3 macros for 1, 2, and 3. They will each focus the app and type the text once. IE no loop. Now set the activation in each to Schedule > "When a Specified Time Has Elapsed". Set the frequency (time interval) and make the calculation date and time under the Range tab to be something like 1/1/2009 12:00. Now create another macro that enables or disables the three macros. You only need one macro with one hotkey if you use the logic "If Macro in Enabled". IE if enabled, disable, else enable.The drawback to this one is that you can not start the scheduled sequence when you fire the macro. IE you will jump into the schedule as if it's been running since 1/1/2009. IE 1 might not be the first one and most likely will fire at something other than 1:02 the first time. But this is a much more elegant route if the exact sequence start time is not important. If the exact start and timing is important then I would have three macros with no activation. Each would have an infinite loop that would check a registry setting of your creation, focus the window, type, and delay the prescribed number of seconds. Use "Timed Delay in Seconds". Then create a macro to launch these three macros and set a custom registry value to "Run". Each time the three cycle they check to see if the values is "Run" and if not abort. Not have this control macro also use the logic I mentioned in #1 to check the value and toggle. IE when it is run if the value is "Run" then change value to "Stop" else launch the three macros. OK, I said two but now I'm thinking there's a problem with that. Eventually they will try to fire at the same time. That's a problem with a solution but now it's getting so complex that I think going back to the single macro solution might be best. Or one macro for execution and another for control like I mentioned above. So here's how a single executioner would work. Loop infinite with the checks like in #2 for abort. In the repeat loop have a one second delay compare the counter to the interval. If it's evenly divisible by 62, 135, or 383 type 1, 2, or 3 respectively. Actually this might be the simplest all tolled.<REPEAT START Start="1" Step="1" Count="999999" Save="TRUE" Variable="%Counter%" _COMMENT="Should be good for a couple of days of run time. If you need more bump the repeat up. I just like using the built in counter."/> <COMMENT Value="Check if user wants us to abort"/> <READ REGISTRY VALUE Key="HKEY_CURRENT_USER\\MyStuff\\GoNoGo" Destination="%GoNoGo%" _COMMENT="This woudl be controled by the 'control macro'. It's the only viable way to terminate a running macro using a hotkey."/> <IF VARIABLE Variable="%GoNoGo%" Condition="\x00" Value="Stop" IgnoreCase="FALSE"/> <MACRO STOP/> <END IF/> <DELAY Flags="\x00" Time="1"/> <COMMENT Value="Type 1 if it's time"/> <VARIABLE MODIFY INTEGER Option="\x03" Destination="%Test%" Value1="%Counter%" Value2="62" _COMMENT="Since these are integers they will round down"/> <VARIABLE MODIFY INTEGER Option="\x02" Destination="%Test%" Value1="%Test%" Value2="62" _COMMENT="Now try to go back"/> <IF VARIABLE Variable="%Counter%" Condition="\x00" Value="%Test%" IgnoreCase="FALSE" _COMMENT="If one divieds and multiplies and the value is the same it's evenly divisible and we know it's time to rock."/> <WINDOW ACTIVATE Title="Notepad" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006" _COMMENT="Make sure it's focused"/> <TEXT TYPE Action="0" Text="1" _COMMENT="Enter the number"/> <END IF/> <COMMENT Value="Type 2 if it's time"/> <VARIABLE MODIFY INTEGER Option="\x03" Destination="%Test%" Value1="%Counter%" Value2="135"/> <VARIABLE MODIFY INTEGER Option="\x02" Destination="%Test%" Value1="%Test%" Value2="135"/> <IF VARIABLE Variable="%Counter%" Condition="\x00" Value="%Test%" IgnoreCase="FALSE"/> <WINDOW ACTIVATE Title="Notepad" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/> <TEXT TYPE Action="0" Text="2"/> <END IF/> <COMMENT Value="Type 3 if it's time"/> <VARIABLE MODIFY INTEGER Option="\x03" Destination="%Test%" Value1="%Counter%" Value2="383"/> <VARIABLE MODIFY INTEGER Option="\x02" Destination="%Test%" Value1="%Test%" Value2="383"/> <IF VARIABLE Variable="%Counter%" Condition="\x00" Value="%Test%" IgnoreCase="FALSE"/> <WINDOW ACTIVATE Title="Notepad" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/> <TEXT TYPE Action="0" Text="3"/> <END IF/> <END REPEAT/> Quote Link to comment Share on other sites More sharing options...
johnh2005 Posted July 28, 2009 Author Report Share Posted July 28, 2009 This is actually not as simple as it may seem. MEP is procedural so having one macro to do it all would result in some really tricky logic. If it were me I would avoid that and create multiple macros to accomplish the task but in that I see a couple of ways and it would depend on how sensitive you are about the timing. Consider these two scenarios. Create 3 macros for 1, 2, and 3. They will each focus the app and type the text once. IE no loop. Now set the activation in each to Schedule > "When a Specified Time Has Elapsed". Set the frequency (time interval) and make the calculation date and time under the Range tab to be something like 1/1/2009 12:00. Now create another macro that enables or disables the three macros. You only need one macro with one hotkey if you use the logic "If Macro in Enabled". IE if enabled, disable, else enable.The drawback to this one is that you can not start the scheduled sequence when you fire the macro. IE you will jump into the schedule as if it's been running since 1/1/2009. IE 1 might not be the first one and most likely will fire at something other than 1:02 the first time. But this is a much more elegant route if the exact sequence start time is not important. If the exact start and timing is important then I would have three macros with no activation. Each would have an infinite loop that would check a registry setting of your creation, focus the window, type, and delay the prescribed number of seconds. Use "Timed Delay in Seconds". Then create a macro to launch these three macros and set a custom registry value to "Run". Each time the three cycle they check to see if the values is "Run" and if not abort. Not have this control macro also use the logic I mentioned in #1 to check the value and toggle. IE when it is run if the value is "Run" then change value to "Stop" else launch the three macros. OK, I said two but now I'm thinking there's a problem with that. Eventually they will try to fire at the same time. That's a problem with a solution but now it's getting so complex that I think going back to the single macro solution might be best. Or one macro for execution and another for control like I mentioned above. So here's how a single executioner would work. Loop infinite with the checks like in #2 for abort. In the repeat loop have a one second delay compare the counter to the interval. If it's evenly divisible by 62, 135, or 383 type 1, 2, or 3 respectively. Actually this might be the simplest all tolled.<REPEAT START Start="1" Step="1" Count="999999" Save="TRUE" Variable="%Counter%" _COMMENT="Should be good for a couple of days of run time. If you need more bump the repeat up. I just like using the built in counter."/> <COMMENT Value="Check if user wants us to abort"/> <READ REGISTRY VALUE Key="HKEY_CURRENT_USER\\MyStuff\\GoNoGo" Destination="%GoNoGo%" _COMMENT="This woudl be controled by the 'control macro'. It's the only viable way to terminate a running macro using a hotkey."/> <IF VARIABLE Variable="%GoNoGo%" Condition="\x00" Value="Stop" IgnoreCase="FALSE"/> <MACRO STOP/> <END IF/> <DELAY Flags="\x00" Time="1"/> <COMMENT Value="Type 1 if it's time"/> <VARIABLE MODIFY INTEGER Option="\x03" Destination="%Test%" Value1="%Counter%" Value2="62" _COMMENT="Since these are integers they will round down"/> <VARIABLE MODIFY INTEGER Option="\x02" Destination="%Test%" Value1="%Test%" Value2="62" _COMMENT="Now try to go back"/> <IF VARIABLE Variable="%Counter%" Condition="\x00" Value="%Test%" IgnoreCase="FALSE" _COMMENT="If one divieds and multiplies and the value is the same it's evenly divisible and we know it's time to rock."/> <WINDOW ACTIVATE Title="Notepad" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006" _COMMENT="Make sure it's focused"/> <TEXT TYPE Action="0" Text="1" _COMMENT="Enter the number"/> <END IF/> <COMMENT Value="Type 2 if it's time"/> <VARIABLE MODIFY INTEGER Option="\x03" Destination="%Test%" Value1="%Counter%" Value2="135"/> <VARIABLE MODIFY INTEGER Option="\x02" Destination="%Test%" Value1="%Test%" Value2="135"/> <IF VARIABLE Variable="%Counter%" Condition="\x00" Value="%Test%" IgnoreCase="FALSE"/> <WINDOW ACTIVATE Title="Notepad" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/> <TEXT TYPE Action="0" Text="2"/> <END IF/> <COMMENT Value="Type 3 if it's time"/> <VARIABLE MODIFY INTEGER Option="\x03" Destination="%Test%" Value1="%Counter%" Value2="383"/> <VARIABLE MODIFY INTEGER Option="\x02" Destination="%Test%" Value1="%Test%" Value2="383"/> <IF VARIABLE Variable="%Counter%" Condition="\x00" Value="%Test%" IgnoreCase="FALSE"/> <WINDOW ACTIVATE Title="Notepad" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/> <TEXT TYPE Action="0" Text="3"/> <END IF/> <END REPEAT/> Thank you Cory for your help. However, I do not know what I am supposed to do with that text you gave me =) I am completely new at this and that looks REALLY confusing... lol. Could you tell me exactly what I am supposed to do. Again, thank you so much for your help. The makers of Macro Express Pro should be paying you =) Quote Link to comment Share on other sites More sharing options...
Cory Posted July 28, 2009 Report Share Posted July 28, 2009 Just copy the text in the in the code section and paste it into the scripting editor. If you're a true newb this might be difficult to understand at first. Normally I can give two methods, one advanced and one for newbs but in this case I don't see an easy way to do a newb version. Typing text is easy but I can think of no simple way to effect this complex schedule. Another alternative is to hire me to write this for you. It shouldn't take very long and I can also tutor you in how it works and teach you a few things. I can even set up a remote session and audio/video conference. If you're interested send me an PM. Otherwise we can continue here but just realize I limit the time I give away here so it might be awhile. Quote Link to comment Share on other sites More sharing options...
paul Posted July 28, 2009 Report Share Posted July 28, 2009 Thank you Cory for your help. However, I do not know what I am supposed to do with that text you gave me =) I am completely new at this and that looks REALLY confusing... lol. Could you tell me exactly what I am supposed to do. Again, thank you so much for your help. The makers of Macro Express Pro should be paying you =) No, actually, you should! Quote Link to comment Share on other sites More sharing options...
johnh2005 Posted July 28, 2009 Author Report Share Posted July 28, 2009 Just copy the text in the in the code section and paste it into the scripting editor. If you're a true newb this might be difficult to understand at first. Normally I can give two methods, one advanced and one for newbs but in this case I don't see an easy way to do a newb version. Typing text is easy but I can think of no simple way to effect this complex schedule. Another alternative is to hire me to write this for you. It shouldn't take very long and I can also tutor you in how it works and teach you a few things. I can even set up a remote session and audio/video conference. If you're interested send me an PM. Otherwise we can continue here but just realize I limit the time I give away here so it might be awhile. holy crap that worked! You rock Cory! I had to fine tune it a little bit but that was because I was not sure of the exact timing needed. You are awesome! Quote Link to comment Share on other sites More sharing options...
Cory Posted July 28, 2009 Report Share Posted July 28, 2009 No, actually, you should! My first good chuckle of the afternoon. 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.