Menu entry for experiment templates

In case you also use experiment templates as normal starting point for your Igor experience this snippet helps out. It creates a new menu item in the File menu which only lists packed experiment templates from a certain path. Remember to change templatePath to an existing location.
#pragma rtGlobals=1     // Use modern global access method.

static StrConstant templatePath   = "C:myTemplates" // change this to a path with igor packed experiment templates
static StrConstant templateSuffix = ".pxt"

Menu "File"
    SubMenu "Experiment Templates"
        getExperimentTemplates(),/Q, loadExperimentTemplate()
    End
End


function/S getExperimentTemplates()

    NewPath/Z/Q/O expTemplatePath templatePath
    return IndexedFile(expTemplatePath,-1,templateSuffix)
end

function loadExperimentTemplate()

    GetLastUserMenuInfo     // sets S_value, V_value, etc.
    string fileName = S_value
    if(cmpstr(fileName,"") == 0)
        print "Can't load the template due to empty filename, aborting"
        return -1
    else
        Execute/P "LOADFILE " + templatePath + ":" + fileName
    endif
end

Forum

Support

Gallery

Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More