Jump to content
Macro Express Forums

Passing variables into Macro Express


Recommended Posts

Hi

 

I am trying to pass text into a variable in MacroExpress and seem to be doing something wrong. I am running:

 

C:\Program Files\Macro Express Pro\MacExp.exe /A1Test /VT2:Now is the time

 

My macro 1Test is simply:

<VARIABLE RESTORE Option="\x00"/>

<MESSAGEBOX Caption="Variable" Message="%T2%" Icon="0"/>
which I had expected to display a box containing the text "Now is the time". Sadly the box appears but is empty.
I suspect I am making a schoolboy error. Any ideas?
Thnx
Link to comment
Share on other sites

 

My macro 1Test is simply:

<VARIABLE RESTORE Option="\x00"/>

 

There are a few errors in your command line and macro!

- You need to surround the C:\Program..... with double quotes (") because of the spaces contained in that command (I suspect you're actually doing this already, otherwise your macro would not run).

- Your macro needs to display the variable %T[2]% instead of %T2%, since the T variable is an array.

- I prefer meproc.exe to macexp.exe.

Link to comment
Share on other sites

If you are using a 64-bit version of Windows you will need to use "C:\Program Files (x86)\Macro Express Pro" instead of "C:\Program Files\Macro Express Pro".

 

Macro Express Pro can have multiple macro files loaded at the same time. The /A command line parameter can be used to specify the macro file along with the macro to run.

 

This is what worked for me.

 

Create a batch (runmacro.bat) file containing this:

"C:\Program Files (x86)\Macro Express Pro\MacExp.exe" /A::c:\Macros\Test4.mex?Test /VT2:Now is the time

You will need to adjust the path to your macro file (c:\Macros\Test4.mex above). You may need to adjust the path to where Macro Express Pro is installed. As Paul mentioned, you could use meproc.exe instead of MacExp.exe.

 

Create a macro that looks like this:

Variable Restore: Restore All Variables

Text Box Display: Results

You can copy and paste it from here:

<VARIABLE RESTORE Option="\x00"/>

<TEXT BOX DISPLAY Title="Results" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 Values from command line: %T[2]%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="458" Height="142" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>

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