Intouch Script Function Sample of FileSelect

Description

FileSelect() presents the user with a standard Windows File Open dialog box and returns the name of the file that you’ve entered. See Tech Support Script Function Library to install this function.

Use:

FileSelect(Title, DefaultDirectory, DefaultExtention, DefaultFilename);

Title A message tag or a quoted string (example: “Title”) which will be placed in the title bar of the File Open dialog box. This parameter can be null. To send a null character, specify an empty string: “” (no spaces between the pair of double quotes).
DefaultDirectory A message tag or a quoted string (example: “C:\”) which will make the File Open dialog box modify the Drive and Directory list boxes to the directory specified. This parameter can be null. To send a null character, specify an empty string: “” (no spaces between the pair of double quotes).
DefaultExtention A message tag or quoted string (example: “*.TXT”) which will make the File Open dialog box change the list of available files based on the given extension. This parameter effects the “Display Files of Type:” combo box. This parameter may be null. To send a null character, specify an empty string: “” (no spaces between the pair of double quotes).
DefaultFilename A message tag or quoted string (example: “LOG.DAT”) which will be displayed and highlighted in the “File Name:” field of the File Open dialog box. DefaultFilename may be null. If DefaultFilename is null and the user selects the Cancel button the string returned will be the empty string: “”.

Returns

Returns a fully qualified path and name of the selected file. If you do not select a file by clicking the Cancel button, the file specified by the DefaultFilename parameter is returned.

Details of FileSelect()

FileSelect() presents you with a standard Windows File Open dialog box. This dialog box functions the same as any other File Open dialog box in a Windows application. The specified parameters will tell the dialog box to start in a particular directory and look at a list of files with a specific extension or look at a particular file by default. The title bar on top of the dialog box can also be specified.

Example of Using FileSelect()

The following is a script that sends a mail message by using FileSelect():

{ This is an example of using the SendMail() Script function }
{ to send the contents of a report file: ReportXX.txt }
{ Call the function to allow operator to pick filename }
SelectedFile = FileSelect(“Open”, “C:\IT90APP”, “*.*”, “Report*.txt”);

This is the result of running the script:

 

In this example script, once you select a file either by clicking OK or by double-clicking on a file name in the list, the selected file (which is fully qualified with the drive letter and path) is returned and is placed into the tag: ‘SelectedFile’. If Cancel is selected, the supplied filename Reports*.txt (no path included) will be returned.

Leave a Reply

Your email address will not be published. Required fields are marked *

+ 11 = 13