Storages.selectFile

機能/意味
Show file selection dialog box
タイプ
Storagesクラスのメソッド
構文
selectFile(params)
引数
params  Specify the dictionary array used for data transfer.
 When passing to this method, you can specify the following members: Also, some members will change value after this method ends.

filter
 Pass the filter string as an array.
 The filter string specifies the description of the filter and the filter separated by | (vertical bar), and specifies a wildcard for the filter. If multiple extensions correspond to one filter, separate them with; (single-byte semicolon).
 To specify multiple filters, specify them in an array.
 If omitted, no filter is used.

Example:
["Image file (*.bmp;*.png;*.jpg;*.jpeg;*.eri;*.tlg)|*.bmp;*.png;*.jpg;*.jpeg;*.eri;*.tlg",
"Script file (*.tjs;*.ks)|*.tjs;*.ks"]

filterIndex
 Specify the number of the selected filter (specified by filter).
 If 1 is specified, the first filter specified by filter is initially selected. Specifying 2 causes the second filter to be selected (note that this is not a zero-based index; the first is 1).
 If omitted, the first filter is selected.
 Also, if the user presses the OK button, this member will be set to the index of the last filter selected in the dialog box.

name
 Specify a file name. By omitting or specifying an empty string, no files can be selected in the initial state.
 Also, if the user presses the OK button, the selected file will be set to this member.

initialDir
 Specify the folder to be displayed in the initial state.
 If omitted, the current directory will be used.

title
 Displays the title of the dialog box.
 If omitted, it defaults to "open" or "save as" (depending on the settings of the save member).

save
 Specify the type of dialog box.
 If false (default), the "Open" dialog box will be used.
 If true, the "Save As" dialog box is used.

defaultExt
 Specify the default extension. This extension is automatically added when the user does not specify an extension. Do not specify. (Period) for the extension specified here.
 If omitted, no extension is added.
戻り値
If the user selects a file and presses the OK button, true is returned, and if the user presses the cancel button, false is returned.
説明
 Opens a file selection dialog box.
例:
var params = %[
filter : [ "Text file (*.txt)|*.txt", "Binary file (*.bin)|*.bin" ],
filterIndex : 1,
name : "",
initialDir : System.exePath,
title : "Open a file",
save : false,
];
if(Storages.selectFile(params))
System.inform("The selected file is : " + params.name);