Search code examples
fileuser-interfacedm-script

Is there a scripting call that is identical to the menu 'File/Open' (Ctrl+O)


With the menu File/Open I can pick a directory and a file within. Is there a scripting call that returns the path and file name? boolean OpenFile(string directory, string filename)


Solution

  • I think you are looking for the OpenDialog() command with it's extended signature:

    RealNumber opendialog( String selected_path )
    Boolean OpenDialog( Window par_win, String prompt, String default_path, String pathname )
    

    As example:

    string prompt = "Please select file."
    string default = GetApplicationDirectory("open_save",0)
    string returned 
    if ( OpenDialog(NULL,prompt,default,returned) )
        OKDialog("User selected:\n"+returned)