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)
-
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?Tim Roberts– Tim Roberts2024-08-03 17:43:04 +00:00Commented Aug 3, 2024 at 17:43
-
1I 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.E Voelkl– E Voelkl2024-08-03 22:54:52 +00:00Commented Aug 3, 2024 at 22:54
Add a comment
|
1 Answer
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)