SelectFile

Opens File Open dialog and returns the path of the file selected in the dialog.

Syntax

SelectFile()

Return

Returns the path of the file selected in File Open dialog.

Examples

Python

import nex
path = nex.SelectFile()
# if the user pressed Cancel in the file dialog, the returned path is empty
if len(path) > 0:
    # open file for reading
    file = open(path, "r")
    # read the first line of the file
    line = file.readline()
    print(line)
    file.close()

NexScript

path = SelectFile()
% if the user pressed Cancel in the file dialog, the returned path is empty
if StrLength(path) > 0
  % open file for reading
  file = OpenFile(path, "r")
  line = ""
  % read the first line of the file
  ReadLine(file, line)
  Trace(line)
  CloseFile(file)
end