Create New Notebook With Options

This bypasses the New:Notebook menu to give a larger set of selection options up front. The intent is to provide a way to set such things as the Notebook NAME and KILL parameters WHILE SETTING UP THE NOTEBOOK rather than AFTER the fact.

Function IgorMenuHook(isSel, menuStr, itemStr, itemNo, topWindowName, wt)
    Variable isSel, itemNo, wt
    String menuStr, itemStr, topWindowName

    Variable handled= 0
    switch(isSel)
        case 0:
            break
        case 1:
            if ( (cmpstr(menuStr,"New") == 0) && (cmpstr(itemStr,"Notebook") == 0) )
                Execute/P/Q/Z "IMH_CreateNewNotebook()"
                handled= 1
            endif
            break
    endswitch
    return handled
End

Function IMH_CreateNewNotebook()

    string ttxt="", ntxt
    variable TtN=2, format=2, kill=1
    prompt ttxt "Title:"
    prompt TtN "Derive Name from Title?", popup "No;Yes;"
    prompt format "Format", popup "UnFormatted;Formatted;"
    prompt kill "Kill As", popup "Normal;Silent;NO KILL;Hide Only;"
    DoPrompt "Create New Notebook", ttxt,TtN, format, kill
    if (V_flag)
        return -1
    endif
   
    format+=-1
    TtN+=-1
    kill+=-1
    if (TtN)
        ntxt = CleanUpName(ttxt,0)
    else
        ntxt = "Notebook"+CleanUpName(time(),0)
    endif
    NewNotebook/F=(format)/N=$ntxt/K=(kill) as ttxt
    return 0
end

Forum

Support

Gallery

Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More