Passing command line argument to a macro

First of all, apologies for bombarding you with questions. I really do appreciate all the very useful responses.
While working on some macros I wanted to pass command line arguments to a macro.
How would I do that?
I tried sys.argv but while my macro can print the passed argument it is not interpreted correctly.
I am trying to use a macro where instead of editing a macro and putting a line like:
pl = get(‘PL:MyPeaklist.1’)
I can pass ‘PL:MyPeaklist.1’ and define pl by passing a command line argument, e.g.
%run -i “C:/Users/jozef/.ccpn/macros/” PL:MyPeaklist.1
or even just
%run -i “C:/Users/jozef/.ccpn/macros/” MyPeaklist.1


Hi, No need of apologising :smiley:

If you want an example you can check the macro (Create an NmrPipe tab file…) here at line 99 is where I define the args, and line(s) 343/344 is when they get inserted in the globals. Then you can run it as it was a normal script with %run -i -argument value
hope it helps

Thank you, Luca. That should do it. I started reading about argparse but was missing a step or two.