Page 1 of 1
Macro arguments
Posted: Thu Oct 09, 2008 12:52 am
by pwdiener
I'm having trouble running a macro and passing a command line parameter. I have a script whocalls.lua in zScript. When I press F10 and type whocalls LUBIN, I get an error saying error loading script 'c:\Program Files\Zeus\zScript\whocalls.lua LUBIN'. It appears that the "command line" isn't being parsed correctly. The script runs fine with no attempt to pass a parameter - it's programmed to ask if it doesn't get one, but I'd like to cut out the extra step/keystroke.
Is this a bug or am I doing something wrong?
Bill
Posted: Thu Oct 09, 2008 3:24 am
by jussij
The
Macro, Execute Script menu does not have an option to supply arguments to the macro.
For example if you save this macro to the
c:\temp\test.lua file:
Code: Select all
--
-- A Simple Zeus Lua macro
--
function key_macro()
screen_update_disable()
FileNew()
print("Argument #0 " .. argv(0) .. "\n")
print("Argument #1 " .. argv(1) .. "\n")
screen_update_enable()
screen_update()
end
key_macro() -- run the macro
and run the script using the the
Macro, Execute Script menu you will see this output:
Argument #0 <Unknown argument>
Argument #1 <Unknown argument>
But if you bind the macro to the menu using the
Macro, Options menu with the following details:
Menu Text: Macro Argument Testing
Macro Name: c:\temp\test.lua
Arguments: ArgOne ArgTwo
Now if you run the macro using the macro menu you will get this output:
Argument #0 ArgOne
Argument #1 ArgTwo
Cheers Jussi
Posted: Thu Oct 09, 2008 12:00 pm
by pwdiener
Thanks for the clarification.
I think the ability to pass parameters from the "command line" would be very useful, so please consider this as a future feature request.
Bill