Example of launching a native application

The following example launches a native application, waits for it to terminate, and then displays the return code from the application in a message window. This example uses the following action elements: Run program action, Message action.

You can copy the text of this macro script from this document into the system clipboard, and then from the system clipboard into the Code Editor (see Copy and paste a script from this guide into the Code Editor). After you save this script in the Macro Editor, you can edit it either with the Macro Editor or with the Code Editor.

You should notice the following facts about this example:
Figure 1. Sample code RUN PROGRAM
<HAScript name="g1" description=" " timeout="60000" pausetime="300"
            promptall="true" author="" creationdate="" supressclearevents="false"
            usevars="true" ignorepauseforenhancedtn="false"
            delayifnotenhancedtn="0">
   <vars>
      <create name="$intReturn$" type="integer" value="0" />
   </vars>
   <screen name="Screen1" entryscreen="true" exitscreen="true" transient="false">
      <description>
         <oia status="NOTINHIBITED" optional="false" invertmatch="false" />
      </description>
      <actions>
         <runprogram exe=
                  "%ProgramFiles%\Windows NT\Accessories\wordpad.exe"
                  param="'c:\\tm\\new_file.doc'" wait="true"
                  assignexitvalue="$intReturn$" />
         <message title="" value="'Return value is '+$intReturn$" />
      </actions>
      <nextscreens timeout="0" >
      </nextscreens>
   </screen>
</HAScript>