Macro arguments

Get help with the installation and running of the Zeus IDE. Please do not post bug reports or feature requests here. When in doubt post your question here.
Post Reply
pwdiener
Posts: 134
Joined: Wed Jul 11, 2007 3:45 pm

Macro arguments

Post 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
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post 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
pwdiener
Posts: 134
Joined: Wed Jul 11, 2007 3:45 pm

Post 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
Post Reply