Jump to content
Macro Express Forums

Jump Back To Earlier Part Of Macro/end A Process


tibolt1

Recommended Posts

I’m new to Macro Express but am finding it an amazing program.

 

Two quick questions – probably very basic to you. (I’ve checked the knowledge base and searched the forum but haven’t found an answer)

 

a) How to I get a macro to jump back to an earlier part of the macro and

B) How do I get it to stop processing a variable length file?

Let me explain.

 

I have a macro that takes a name from a list in document A and searches document B for a match. If it finds a match it enters a piece of text after the name (in document B), goes back to document A, and deletes the name there. It then selects the next name on the list and runs the routine again. I use ‘Start Repeat’ and ‘End Repeat’ to run the routine 30 times.

 

If the macro doesn’t find a match, I want it to go back to document A and not delete the name but select the next name (so that when the process finishes, document A will contain a list of unmatched cases.) Where there’s no match, I can get the macro to go back to document A and move down to the next name (using an If statement), but how do I get the macro to start running again from the start ( actually from line 3).

 

To put it another way how do I put a flag or label at line 3, so that when the macro finishes processing the IF statement it pops back up to the flag/label and continues executing the macro from there.

 

2nd issue – document B may have a different number of names in it , every time the macro is run. How do I get a macro to stop running when it comes to the end of the list (or a document for that matter)?

 

I hope you don't mention variables, as I haven't really got my head around them yet.

 

Thanks in advance for your reply. I appreciate it.

 

T.

Link to comment
Share on other sites

We have had many requests for Goto and Label commands to allow macro execution to skip back to a previous point in the macro. It looks like this will be added to a future version of Macro Express. It is not in the current version.

 

You might find it useful to put the part of the macro that needs to be repeated into a separate 'No Activation' macro. Then use the Macro Run command to run it at the appropriate points in your macro.

 

Use the Break command to terminate a loop such as a Repeat loop, an ASCII Text Begin/End Process loop, or a Text File Begin/End Process loop.

 

Here is an example of how to use the Break command:

Repeat Until %T1% <> %T1%
 
 // Put commands to read from the file here
 // Do something to indicate that the macro has processed all of the names
 
 // For this example, setting T2 to DONE indicates all the names have been processed
 If Variable %T2% = "DONE"
   Break
 End If
 
Repeat End

Link to comment
Share on other sites

  • 11 months later...

Another vote for adding a GOTO statement to ME...

 

I've coded myself into a corner and am used to relying on GOTO to bail me out.

 

The problem is that I'm marching throught the code and if a certain condition is met, I need to do some special stuff, skip some other stuff and continue with the rest of the macro.

 

I realize I can do this by dividing up the various tasks into other macros that are called within IF statements, but that's work! (Doh, I should have used the comments more liberally!)

 

Please implement the GOTO, ASAP, for the sake of lazy programming hacks like myself. It would be really, really appreciated!

 

Keep up the good work!

 

Jason

Link to comment
Share on other sites

I am absolutely against any form of GOTO which will inevitably lead to bad coding habits and Spaghetti code.

 

I think it is a really bad idea which will come back to haunt Insight Software.

 

These forums will soon be filled with questions like, "why doesn't my spaghetti code work?" and "can you help me sort thru this spaghetti?". Plus you would not be able to remove the feature without breaking scripts.

 

It would be much better to implement procedural (structured) programming, in particular Subroutines, which are also called functions or procuderes.

 

In the meantime we have the Macro Run command (as mentioned above), but it is a poor substitute mainly because it take extra effort to pass variables between macros.

 

We could also do with more advanced data structures, like named variables (instead of T1, T2, etc) and arrays (which I have implemented, BTW, at great complexity).

 

Macex has the potential of being a really good scripting language and with a few more improvements, it can be seen as a real programming language.

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.

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

Loading...
×
×
  • Create New...