OpenFolderDialogBox

From GECK
Jump to: navigation, search


A function added by the SUP NVSE Plugin.

Description

Opens native Windows "Choose folder" dialog box and returns a filepath to a file which user has chosen.

Syntax

[help]
(FilePath:string) OpenFolderDialogBox UDF:script

Example

OpenFolderDialogBox MyUDF

Will open a new folder choose dialog box and will call MyUDF when user has chosen the file.

Handler Script

A skeleton handler script for this event:

Scriptname MyUDF

int iSuccess
string_var sv_FolderPath


begin function {iSuccess,sv_FolderPath}
	Print "Success is " + $iSuccess

        if iSuccess == 1 ; iSuccess will return 0 if folder is not chosen by user.
          Print "sv_FolderPath is " + $sv_FolderPath
        endif

end


Notes

  • Works only on Windows Vista+ systems(Windows Vista,Windows7,Windows8, Windows10, Windows11). Doesn't work on Windows XP. You can check Windows version with GetPCTrait.
  • During Windows choose folder dialog box game execution is halted.
  • Some folderpath symbols might not be supported, for instance, English version of Fallout: New Vegas will not display cyrillic symbols.
  • Any form ID can be specified instead of script for testing purposes;
  • When using string result, keep in mind that it's returning case-sensitive file path(while GetFalloutDirectory returns case-insensitive path). Thus you need to use case insensitive string search if you want to check if chosen file contains file directory to remove path from string output later.

See Also