typestar

Menus in Igor Pro

A Menu block adds items to Igor's own menus, and each item names a call.

Menu "Analysis"
    "Smooth front trace", SmoothFront(5)
    "-"
    Submenu "Export front window"
        "PNG/1", ExportFront(-2)
    End
End

Function ExportFront(Variable format)
    String win = WinName(0, 1)
    SavePICT/O/WIN=$win/E=(format)/B=300 as win
    return 0
End

Function SmoothFront(Variable width)
    String traces = TraceNameList("", ";", 1)
    WAVE w = TraceNameToWaveRef("", StringFromList(0, traces))
    Smooth/B width, w
End

How it works

  1. The block is Menu "Name" ... End, at the top level of a file.
  2. An item is a string, a comma, and the call to make.
  3. A "-" item draws a separator; /1 sets a keyboard shortcut.

Keywords and builtins used here

The run, in numbers

Lines
19
Characters to type
403
Tokens
90
Three-star pace
90 tpm

At the three-star pace of 90 tokens a minute, this run takes about 60 seconds.

Type this snippet

Step 5 of 5 in Wiring it up, step 17 of 18 in Panels & GUI.

← Previous Next →