Function to check whether a panel of given name exists?

Dear all,

I wondered whether there is a function or other possibility to check whether a panel of a given name is already open? So that I can close it before opening another instance of it (which almost always causes confusion and mayhem in IGOR).

Any ideas?

Best regards,

Peter
Another possible response to finding the panel already open is to bring the open one to the front and cancel creating a new panel.
Thanks a lot guys, I came up with this:

// Function for killing a panel if it exists:
Function kill_panel(panelName)
    String panelName
    // if there is a panel of this name open...
    if (WinType(panelName) == 7)
        // ... kill it
        String path = panelName
        KillWindow $path
        return 0
    else
        return -1
    endif
End
jtigor wrote:
Another possible response to finding the panel already open is to bring the open one to the front and cancel creating a new panel.


I tend to use code like this:

DoWindow/F myPanel      // bring panel to the front if it exists
if( V_Flag == 0 )       // panel doesn't exist
    NewPanel/N=myPanel  // create it.
    ... etc ...
endif


--Jim Prouty
Software Engineer, WaveMetrics, Inc.