3

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)

2
  • Are you saying you want the script to open a file, or are you saying you want a way to capture the last file that the user opened by hand? Commented Aug 3, 2024 at 17:43
  • 1
    I want to make a script where the user opens a file just as with the menu item. I had hoped for a scripting call that would give me the file name and path once the user has made the pick. I need that info for the next steps. ... Not so nice: the user has to open the file first and then I follow up with GetFrontImage() or similar and take it from there. Commented Aug 3, 2024 at 22:54

1 Answer 1

4

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)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.