Command Shorthands

Here is the whole sequence of how to use a IPython variable as a shorthand for commands:

p09/door/exp.01 [1]: wm exp_mot01 exp_mot02 exp_mot03 exp_mot04
          exp_mot01  exp_mot02  exp_mot03  exp_mot04
User                                                
 High           500        200        500        180
 Current        1.0   -160.002      362.0       -1.0
 Low           -500       -200       -500       -180

p09/door/exp.01 [2]: macro slt1 1
Macro `slt1` created. To execute, type its name (without quotes).
Macro contents:
_ip.magic("wm exp_mot01 exp_mot02 exp_mot03 exp_mot04")

The first line 'wm exp_mot01 exp_mot02 exp_mot03 exp_mot04' displays the position of four motors. The command 'macro slt1 1' gives the command on line 1 the name slt1. Such a definition may comprise more than on command line. Use macro? for the syntax.

The variable slt1 may be stored for being used in other Spock sessions:

p09/door/exp.01 [3]: store slt1
Stored 'slt1' (Macro)

p09/door/exp.01 [4]: store
Stored variables and their in-db values:
__spock_store             -> {'database_list': {'haso107klx': None}}
__tango_store             -> {'database_list': {'haso107klx.desy.de': None}}
slt1                      -> IPython.macro.Macro(u'_ip.magic("wm exp_mot01 exp_...

The command 'store' tells you which IPython variables have been defined.

A variable can be deleted by:

p09/door/exp.01 [5]: store -d slt1

p09/door/exp.01 [6]: store
Stored variables and their in-db values:
__spock_store             -> {'database_list': {'haso107klx': None}}
__tango_store             -> {'database_list': {'haso107klx.desy.de': None}}