koden Posted February 9, 2006 Report Share Posted February 9, 2006 I use in my macro IF some places. maybe I don't understand it right... Example: I would like a repeat function to stop and start from beginning if a surdent window is running. If this window is not running, then the macro should go on to the repeat end. This is not working, because the macro tells me that I have a repeat end standing alone. if window title "xxxxxx" is running repeat stop end if How ist the right way to do this??? The full story is that i'm creating new employes in a program. but sometimes they alredy exist. So before creating them I check if they already there. The only way I can do that is to open the profile with the data of the person. This profile window has a title. If they allready exist,then this window appears, and the macro schould go back to the beginning and copy the next new employe. If not existing there is no window and the macro can continue to create the person. Quote Link to comment Share on other sites More sharing options...
cyberchief Posted February 9, 2006 Report Share Posted February 9, 2006 Rather than using Repeat Stop... use "BREAK". I don't think you can have a Repeat Stop in the middle of an if statement. Quote Link to comment Share on other sites More sharing options...
koden Posted February 10, 2006 Author Report Share Posted February 10, 2006 What does break do? Stop the macro or just break the if command? Quote Link to comment Share on other sites More sharing options...
paul Posted February 12, 2006 Report Share Posted February 12, 2006 You know, I think it would have taken you just the same amount of time to look up the break command in ME's excellent help file instead of asking someone else to explain it to you! Quote Link to comment Share on other sites More sharing options...
jowensii Posted February 13, 2006 Report Share Posted February 13, 2006 You know, I think it would have taken you just the same amount of time to look up the break command in ME's excellent help file instead of asking someone else to explain it to you!Finally, someone has said it. ME's help documentation is very good and I think often times overlooked. I love the posts in which it is painfully obvious that little or no effort was exerted before turning the ME forum and hoping for a quick answer. Or better yet, submit a post and maybe someone will create the macro for you. I'm not accusing koden of this and paul may have been a little blunt. This a friendly, helpful group and hope it remains that way but it's certainly long overdue that someone put this out there. Quote Link to comment Share on other sites More sharing options...
koden Posted February 13, 2006 Author Report Share Posted February 13, 2006 Hello guys... This time you are right... I schould of course have looked in the help function. Sorry... I normally always look in the help before posting. The help function is sometimes very good, and sometimes not. My english understanding is not always that good, and sometimes i need "special explanation" :-)) Ex. In this case I could not find anything in help. Quote Link to comment Share on other sites More sharing options...
kevin Posted February 13, 2006 Report Share Posted February 13, 2006 I can certainly understand having difficulty reading the help documentation. Often you need to know what term to search for before you can find a description in the help. Knowing the correct term to search for can sometimes be difficult. However, within Macro Express, you can always highlight a macro command, either in the 'Commands' pane or within the Macro Script pane, and press F1. This brings up the help topic for the highlighted command. (This even works for the Break command.) I normally always look in the help before posting. The help function is sometimes very good, and sometimes not. Ex. In this case I could not find anything in help.We at Insight Software Solutions appreciate hearing about ways we can improve Macro Express, including the help documentation. I notice that you refer to 'repeat stop' in your sample macro. Macro Express 3.x does not have a 'Repeat Stop' command. 'Repeat stop' could refer to the Repeat End, Repeat Exit or Break commands. When asking questions it is helpful to be precise, especially when referring to macro commands. There are 7 macro commands that start a repeat loop. For each command that starts a repeat loop there can be only be one Repeat End command. Thus, this does not work: Repeat Start (Repeat 999 times) If Window Title "Notepad" is running Repeat End Break End If Repeat End In fact, if you try this then Macro Express will display a syntax error. This macro snippet seems to be what you want: Repeat Start (Repeat 999 times) If Window Title "Notepad" is running Break End If Sound Wave File: 7.wav Delay 1 Seconds Repeat End You could also use the Repeat Exit command: Repeat Start (Repeat 999 times) If Window Title "Notepad" is running Repeat Exit End If Sound Wave File: 7.wav Delay 1 Seconds Repeat End I have requested that the Repeat command help topic be reviewed to see what changes can be made to make it clearer. Quote Link to comment Share on other sites More sharing options...
koden Posted February 13, 2006 Author Report Share Posted February 13, 2006 Thanks a lot.. will try this. Quote Link to comment Share on other sites More sharing options...
koden Posted February 14, 2006 Author Report Share Posted February 14, 2006 break is not good, because it just stops the macro. I think I need this: Repeat Start (Repeat 999 times) If NOT Window Title "Notepad" is running "then stop this repeat 1 and go on with repeat 2 (next repeat.) If there was only 1 repeat, then end macro" "If notepad is running, then go on with the macro" End If Sound Wave File: 7.wav Delay 1 Seconds Repeat End Do you understand my text?? I'm just not sure how to put this in a IF command??? Quote Link to comment Share on other sites More sharing options...
koden Posted February 14, 2006 Author Report Share Posted February 14, 2006 I will try explain in another way. I use notepad as the window just to make it easy. My problem is: I put some data into a field and make a search. When the search find something, then it opens this window (notepad :-) If the search is empty, there is no notepad window opening. If notepad does NOT open, then the macro has to stop/break here. But if I have ask for 2 or more repeats, then it has to go back to the repeat start and go on with the macro again. So I surpose I have to use something like this: IF NOT window title "notepad" is running Break OR "if there is a next repeat, then go back and run this repeat". End If But how do I make a command that does what stands in " " ???? Just for info: The macro first copy data from program A to notepad with a repeat start prompt. There is no problem in this. This repeat can run from 1 to many times. After this is finished another repeat start prompt copy from notepad to program B the same times as the first start prompt repeat. And it's in this second start prompt the problem is... Quote Link to comment Share on other sites More sharing options...
kevin Posted February 14, 2006 Report Share Posted February 14, 2006 Break will stop the Repeat loop. Macro Stop will stop the macro. If there are no other commands in your macro then stopping the Repeat loop will stop your macro. If you want to skip an iteration of the Repeat loop and go on to the next step then you can use If statements. Something like this: Repeat Start (Repeat 999 times) If Not Window Title "notepad" running // DO 'SKIP' STUFF HERE Else // DO YOUR MACRO STUFF HERE End If Repeat End You can add logic to stop the macro by doing something like this: Repeat Start (Repeat 999 times) If Not Window Title "notepad" running // DO 'SKIP' STUFF HERE Else // DO YOUR MACRO STUFF HERE End If If Variable %T1% contains "something" Macro Stop End If Repeat End Quote Link to comment Share on other sites More sharing options...
koden Posted February 16, 2006 Author Report Share Posted February 16, 2006 I have made this IF start repeat If Not Window Title "notepad" running Break Else // The macro comes here with all it's paste into notepad End If End repeat // the macro here shut down the notepad. But I get the error that there is no matching end if ??? Another thing. Break just stop the macro. Instead of break I would like the macro to break at this point and go back and start at the beginning of the macro. I have attached my macro. My_macro.mxe Quote Link to comment Share on other sites More sharing options...
kevin Posted February 16, 2006 Report Share Posted February 16, 2006 But I get the error that there is no matching end if ??? I downloaded your macro and did not see this problem. Instead of break I would like the macro to break at this point and go back and start at the beginning of the macro.You could surround your macro with another repeat: Repeat Start (Repeat 999 times) Repeat Start (Repeat 999 times) If Not Window Title "notepad" running // DO 'SKIP' STUFF HERE Else // DO YOUR MACRO STUFF HERE End If If Variable %T1% contains "something" Macro Stop End If Repeat End Repeat End Quote Link to comment Share on other sites More sharing options...
koden Posted February 17, 2006 Author Report Share Posted February 17, 2006 Thanks again... I have found out what was wrong. If you look at my macro, you will see a end if AFTER the repeat end. I have put end if BEFORE repeat end, and it's working. By the way... normally I get mail when someone post an answer. But not this time ??? 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.