rockdude Posted June 1, 2009 Report Share Posted June 1, 2009 I just started messing with Macro Express pro and iv been trying to figure out how to make a macro that loops adding 1 to a set of numbers any help? This is what i need, i will need a macro that will bring my mouse over to this text box i have then type in BMEX1000 in that text box ( this much i easily know how to do with just plain old mouse keyboard capturing). Heres the tricky part i need the macro after the BMEX1000 to then press enter on the keyboard then wait a little while and then type the same thing but this time to add +1 to the number in this case BMEX1001 will be entered next, then next time BMEX1002 and so on till BMEX1999. I really have no clue how to do this and will great appreciate some help! Thanks Quote Link to comment Share on other sites More sharing options...
Cory Posted June 1, 2009 Report Share Posted June 1, 2009 Create an Integer variable for the serial number. Let's call it %Serial%. Initially set it to 1000 in this case then create your loop with the delay and typing. Each iteration of the loop simply increment the integer. Your text type will be BMEX%Serial%. I do not know what you want for criteria for your loop but you can either use a Variable Modify Integer - Increment or use the counter in the repeat command. In the attached sample I created two macros for you, Incrementer 1 and 2. Open Notepad and use the CTRL+Keypad1 hotkey got the first and CTRL+Keypad2 for the other. It will type out your string 10 times starting at 1000. The first illustrates how to use the built in counter in the Repeat command but often one does no know how many times one needs to repeat in advance so I showed the other as well. Without more details I couldn't advise which is best but this will illustrate the incrementing. Increment.mex Quote Link to comment Share on other sites More sharing options...
rockdude Posted June 1, 2009 Author Report Share Posted June 1, 2009 Create an Integer variable for the serial number. Let's call it %Serial%. Initially set it to 1000 in this case then create your loop with the delay and typing. Each iteration of the loop simply increment the integer. Your text type will be BMEX%Serial%. I do not know what you want for criteria for your loop but you can either use a Variable Modify Integer - Increment or use the counter in the repeat command. In the attached sample I created two macros for you, Incrementer 1 and 2. Open Notepad and use the CTRL+Keypad1 hotkey got the first and CTRL+Keypad2 for the other. It will type out your string 10 times starting at 1000. The first illustrates how to use the built in counter in the Repeat command but often one does no know how many times one needs to repeat in advance so I showed the other as well. Without more details I couldn't advise which is best but this will illustrate the incrementing. thanks alot, this helps me alot to understand this but i still dont know 100% how i would do this, if you could help me some that would be great! here is key for key what i would need it to do enter key tab key enter key tab key enter in BMEX1000 code here which still the same each loop i need it to add 1 to the 1000 tab key up arrow key up arrow key up arrow key enter key enter key enter key enter key think you can help me out on this!thanks Quote Link to comment Share on other sites More sharing options...
rockdude Posted June 2, 2009 Author Report Share Posted June 2, 2009 thanks alot, this helps me alot to understand this but i still dont know 100% how i would do this, if you could help me some that would be great! here is key for key what i would need it to do enter key tab key enter key tab key enter in BMEX1000 code here which still the same each loop i need it to add 1 to the 1000 tab key up arrow key up arrow key up arrow key enter key enter key enter key enter key think you can help me out on this!thanks actually i think im understanding it now Quote Link to comment Share on other sites More sharing options...
rockdude Posted June 2, 2009 Author Report Share Posted June 2, 2009 now i have another problem the program im trying to run this macro in wont let the macro run at the same time!! why might this be and how can i fix that? like when this program is the active window and i run the macro hot key it doesnt start it or detect it at all, but as soon as i click off the program window so its not the active window the macro starts up so what should i do? Quote Link to comment Share on other sites More sharing options...
rockdude Posted June 2, 2009 Author Report Share Posted June 2, 2009 ok nevermind that last stuff, but i have another issue how do i set up the macro so i can go thru the zero number set so the macro starts at BMEX0000 and goes up 1 at a time, so then next it would be BMEX0001 and so on? Quote Link to comment Share on other sites More sharing options...
kevin Posted June 2, 2009 Report Share Posted June 2, 2009 This should do it: Variable Set Integer %Serial% to 0 // Start with 0 // Inside your loop Variable Modify Integer %Serial%: Convert to Text String (%SerialStr%) Variable Modify String %SerialStr%: Pad Left (4) // Pad to 4 characters (with spaces) Variable Modify String: Replace " " in %SerialStr% with "0" // Replace all spaces with 0's Quote Link to comment Share on other sites More sharing options...
rockdude Posted June 2, 2009 Author Report Share Posted June 2, 2009 thanks I tried putting your stuff in to my original one i used for numbers 1000 and up, but i cant get it working i must be missing something or not typing something in right. When I started my version it would not input any numbers just the characters none of the serial. Mabye know what im doing wrong? thanks this below is my original macro i used for 1000 to 9999 counting <REPEAT START Start="5000" Step="1" Count="1001" Save="TRUE" Variable="%Serial%"/> <TEXT TYPE Action="0" Text="BMEX%Serial%<TAB><TAB><TAB>"/> <DELAY Flags="\x01" Time=".5"/> <TEXT TYPE Action="0" Text="back123<TAB><TAB><TAB><TAB><TAB>\r\n"/> <DELAY Flags="\x01" Time="1"/> <TEXT TYPE Action="0" Text="<ENTER>"/> <DELAY Flags="\x01" Time="5"/> <MOUSE LEFT DOUBLE CLICK/> <END REPEAT/> Quote Link to comment Share on other sites More sharing options...
rockdude Posted June 3, 2009 Author Report Share Posted June 3, 2009 haha nevermind im dumb i thought of how i can do this 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.