From WikiChip
Editing mirc/identifiers/$msfile
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
This page supports semantic in-text annotations (e.g. "[[Is specified as::World Heritage Site]]") to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the getting started, in-text annotation, or inline queries help pages.
Latest revision | Your text | ||
Line 2: | Line 2: | ||
== Synopsis == | == Synopsis == | ||
− | * '''$msfile(<path> [,title [,OpenButtonText] ] )''' Opens dialog to choose 1 or multiple files. Returns N where 0 | + | * '''$msfile(<path> [,title [,OpenButtonText] ] )''' Opens dialog to choose 1 or multiple files. Returns N where N>=0 is the number of selected files, N=-1 if too many files selected. |
− | * '''$msfile(N)''' After dialog closes, for N>=1 returns the Nth selected filename. For N=0 returns the count of | + | * '''$msfile(N)''' After dialog closes, for N>=1 returns the Nth selected filename. For N=0 returns the same value as returning by the identifier closing the dialog, the count of selected files. |
== Parameters == | == Parameters == | ||
− | * '''path''' Starting folder for the file select dialog. Can be a relative path to $mircdir. Ignores the last "\" delimited token if path doesn't end with "\" or "/" | + | * '''path''' Starting folder for the file select dialog. Can be a relative path to $mircdir. Ignores the last "\" delimited token if path doesn't end with "\" or "/". |
* '''title''' Optional string placed in the titlebar of the select dialog | * '''title''' Optional string placed in the titlebar of the select dialog | ||
* '''OpenButtonText''' Optional string to replace 'Open' on that button of the select dialog. You cannot set this parameter without first defining the the title parameter to a non-null string. | * '''OpenButtonText''' Optional string to replace 'Open' on that button of the select dialog. You cannot set this parameter without first defining the the title parameter to a non-null string. | ||
− | * '''N''' When N>=1, returns the Nth selected filename N=0 is the | + | * '''N''' When N>=1, returns the Nth selected filename N=0 is the total number of files selected. |
− | |||
− | |||
== Properties == | == Properties == | ||
Line 19: | Line 17: | ||
== Local Identifier == | == Local Identifier == | ||
− | + | '''$sfstate''' Returns the null string or 'cancel' or 'error' after exiting the dialog. | |
− | |||
− | |||
− | |||
== Example == | == Example == | ||
− | <source lang="mIRC">//echo -ag $msfile($sysdir(profile),This shows in Titlebar,OpEn) | + | <source lang="mIRC">//echo -ag $msfile($sysdir(profile),This shows in Titlebar,OpEn) $sfstate | var %i 0 | echo -ag sfstate $sfstate | while (%i < $msfile(0)) { inc %i | echo -ag %i / $msfile(%i) }</source> |
The 2nd parameter puts your optional string in the titlebar. The 3rd optional parameter alters the label on the 'Open' button. | The 2nd parameter puts your optional string in the titlebar. The 3rd optional parameter alters the label on the 'Open' button. | ||
− | + | If you press ESCAPE or click cancel, the identifier returns 0 because zero files were selected. $msfile(0) is also filled with the same value, the number of files selected. Also, the local $sfstate identifier is filled with the string 'cancel'. | |
− | |||
− | If you press ESCAPE or click cancel, | ||
You can select multiple files and/or folders by pressing the Control key while clicking on filenames in the dialog. If the 1st (or only) item selected is a folder, clicking 'open' (or double-clicking on the folder) navigates into that folder. | You can select multiple files and/or folders by pressing the Control key while clicking on filenames in the dialog. If the 1st (or only) item selected is a folder, clicking 'open' (or double-clicking on the folder) navigates into that folder. | ||
− | Otherwise, folders are ignored in the returned count and list of filenames returned | + | Otherwise, folders are ignored in the returned count and list of filenames returned. You can also select a range of filenames by single-clicking on a file, then hold down the shift-key while clicking on a different file. All files in that range will be selected. If the Control key is pressed while you click on the 1st file in that range, you can select that range without losing the earlier selection(s). |
If you double-click on a file, the dialog behaves as if you selected that file and then pressed the OPEN button, returning that filename as $msfile(1). If you double-click on a file while pressing the Control key and while other files are already selected, any prior selections are not cleared, returning values as if you clicked OPEN while those multiple files are selected. | If you double-click on a file, the dialog behaves as if you selected that file and then pressed the OPEN button, returning that filename as $msfile(1). If you double-click on a file while pressing the Control key and while other files are already selected, any prior selections are not cleared, returning values as if you clicked OPEN while those multiple files are selected. | ||
− | If your first selection is a folder, the dialog navigates into that folder for selecting files there, clearing | + | If your first selection is a folder, the dialog navigates into that folder for selecting files there, clearing all files selected in the original folder. If your first selection is a filename, the identifier and $msfile(0) both return the number of selected files. It doesn't matter which order you click on files, because the returned files are filled into $msfile(N) in the order they appear in the dialog window, which could be sorted by filename, size, etc in normal or reverse order. |
Once you've clicked anywhere within the dialog to set the focus there, even if you haven't selected a file, you can then press Control-A within the dialog, and it selects all the files before selecting all the folders, and $msfile(N) is filled in the dialog's sort order. | Once you've clicked anywhere within the dialog to set the focus there, even if you haven't selected a file, you can then press Control-A within the dialog, and it selects all the files before selecting all the folders, and $msfile(N) is filled in the dialog's sort order. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Compatibility == | == Compatibility == | ||
Line 59: | Line 42: | ||
* {{mIRC|$sfile}} | * {{mIRC|$sfile}} | ||
* {{mIRC|$sdir}} | * {{mIRC|$sdir}} | ||
− |