Macro Exceute Tag - $MEX
Posted: Sat Mar 16, 2024 8:16 am
The latest version of Zeus adds a $MEX macro tag which allows the creation of a tag value based on the results of a macro script.
This macro execute tag can be used in this basic format:
Alternatively, the tag can be used in this arguments format:
The macro_script represents the name of the script to be run and the arguments represent space delimited argument values passed to the macro.
Here is an example of a typical script:
This actual macro comes as part of the latest installation and can be found in the Zeus zScript folder in the mex-test.lua file.
Here is an example of how this macro script can be used using the basic format:
Here is an example of how this macro script can be used using the arguments format:
To see how these work, use the Tools, DOS Command Line menu and run this echo command:
That will result in the following output:
And when this command is run:
That will result in the following output:
Another example is the mex-dir.py macro, which lists the files in a folder based on file filter.
For example, this echo will list all text files in the current directory:
This echo example lists all text files in the c:\temp directory:
Cheers Jussi
This macro execute tag can be used in this basic format:
Code: Select all
$MEX<macro_script>
Code: Select all
$MEX<macro_script arguments>
Here is an example of a typical script:
Code: Select all
function key_macro()
local arguments = "";
local count = argc();
if count > 0 then
count = count - 1;
for i = 0, count, 1 do
arguments = arguments .. argv(i)
arguments = arguments .. ' '
end
end
local message = "This output generated was by the 'mex-test.lua' macro."
if (string.len(arguments) > 0) then
message = message .. " Arguments Supplied: " .. arguments
end
-- this will be the result of the macro expansion
print(message)
end
key_macro() -- run the macro
Here is an example of how this macro script can be used using the basic format:
Code: Select all
$MEX<mex-test.lua>
Code: Select all
$MEX<mex-test.lua arg1 arg2 arg3>
Code: Select all
echo $MEX<mex-test.lua>
Code: Select all
This output generated was by the 'mex-test.lua' macro.
Code: Select all
echo $MEX<mex-test.lua arg1 arg2 arg3>
Code: Select all
This output generated was by the 'mex-test.lua' macro. Arguments Supplied: arg1 arg2 arg3
For example, this echo will list all text files in the current directory:
Code: Select all
echo $MEX<mex-dir.py *.txt>
Code: Select all
echo $MEX<mex-dir.py c:\temp\ *.txt>