Jump to content
Macro Express Forums

Calling Macros From Batch File


sak

Recommended Posts

Hello, I have recently started evaluating macro express for our documentation build automation. Our docs are built as a part of the main product build. Most of the components are built using make and for doc which is in "Robohelp HTML" we use a macro which basically simulates the build from the robohelp gui since RoboHelp HTML does not have a command line build option for XPJ project files.

 

The issue we are having is that the macro passes back the control to the next command in the build batch file almost immediately after starting the macro and does not wait for all the commands to be executed. This creates a problem for build logging since all the build processes write to a single build log file.

 

Example of batch file

 

nmake # Builds Visual Studio project

meproc /F%R1BUILD%\robohelp.mex /Amacro_term /B /EN # MAcro for robohelp

RunEslBatch # Frame Script for building framemaker project.

 

First nmake runs and when complete passes control to the macro which executes and immediately passes control back to the batch file which start the nexct commnd - RunEslBatch ,and now I have 2 build processes running simultaneously.

 

Is there a way to make the maco not pass control back to the batch file till is completed ( Error or Success ). I have tried adding the macro command to another batch file and calling that batch file from the first one and I even tried the start /wait windows command but none seem to work.

 

I hope this forum can provide me some ideas on how to accomplish this. In the build I have may commands which start GUI's like Framemaker and Powerbuilder . but they all pass control to the next commnd in the batch file only after they have completed execution.

 

Thanks

Link to comment
Share on other sites

Hi,

I don't know RoboHelp; it would depend, I think, whether there is a specific Window or process opened (for which there may be a "Wait" command) to run the "batch" commands you are talking about which ME calls? - is it a "DOS" batch command, for instance? - Someone else may know the type of process you are discussing.

Randall

Link to comment
Share on other sites

Hi ,

 

I gave an example of robohelp, but this is true with any macro called from the batch file. Basically when I execute any macro from a batch file the control goes back to the batch file as soon as meproc executes and does not wait till the macro is fully executed.

 

Another example ( entry in aa.bat):

 

meproc /F%R1BUILD%\robohelp.mex /Amacro_term /B /EN

 

meproc /F%R1BUILD%\robohelp.mex /Amacro_term /B /EN

 

The first macro just opens notepad and closes it . The next runs the build. When i call aa.bat both the macros are started simultaneous . The second macro does not wait for the first one to be completed.

 

If someone is calling multiple macros from a windows batch file please let me know.

 

-Safder

Link to comment
Share on other sites

Welcome to the group sak!

 

What we do in almost every instance is to have the called application write something to either the Registry or a test file signaling when it's assigned task is completed. Macro Express then waits for that Registry key or file to be written prior to continuing. Some think, even in my own organization ... f l o y d, without mentioning any names that this is "cludgy" (sp?), however I find that it works every time and is easy to implement. Within a macro:

 

Launch program

Wait for file "program done.txt"

Continue macro here

Link to comment
Share on other sites

I have done similar things; I think I see what you mean, Joe; the batch file here is a DOS batch file; you cannot stop the batch file going on to the next ME3 call, but the ME3 macro should check before it goes on whether the previous instance has completed its task and written the "marker" file or registry entry (even environment variable would still be preserved?)

Randall

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