Read a File Selected by the User
Opens a text file in a dialog by prompting the user for the filename to open
This sample task opens a text file in a dialog by prompting the user for the filename to open. Two variables are created. INPUT_FILE which will contain the value of the file chosen, and DATA which will be populated with the contents of the file and passed to a message box to be displayed.
A 'Common Dialog' action is configured to prompt the user for a file to open. To prompt for opening a file, the "dialog type" on the 'General' tab of this action must be set to "open file dialog." The variable named INPUT_FILE is selected in the "Populate variable with result" field. The 'Advanced' tab provides a filter (i.e. *.txt) and an initial folder to start from. For this sample, C:\ will be entered as the initial folder.
The DATA variable is then passed to a message box to be displayed using the 'Message Box' action.