FileRequest -- pop up a file requester
f$ = FileRequest(title$[, pattern$, mode, defdir$, deffile$])
This function pops up a file requester that allows the user to select a file. You can specify the title of the requester by setting the title$ argument. The second argument is optional and allows you to specify a filter pattern. Only files which match this filter pattern will be selectable in the requester. The filter pattern is a string that contains a number of file endings that will be accepted by the requester. These endings must be separated by '|' characters. For example: "voc|wav|8svx|16sv|iff|aiff" will only show files which have one of these endings. If you do not want to use a filter, pass "" or "*" in pattern$.

The file that the user selected will be returned in f$ including the path where it resides. If the user cancels the requester, the string f$ will be empty.

New in v2.0: The optional mode argument allows you to put the requester into save or multiselect mode. For save mode, pass #REQ_SAVEMODE and for multiselect mode pass #REQ_MULTISELECT. If you use multiselect mode, this function will not return a string but a table that contains all the files the user selected terminated by an empty string.

New in v3.0: The two optional arguments defdir$ and deffile$ allow you to specify the initial directory and file when the requester opens. By default, this will be the current directory with no file currently selected.

Starting with Hollywood 6.0 you can also set the flag #REQ_HIDEICONS if you want to have *.info files hidden on AmigaOS. Note that #REQ_HIDEICONS is a flag that can be combined with the other modes by ORing it into a bitmask. #REQ_HIDEICONS is only supported on AmigaOS.

title for the requester; pass an empty string ("") to use the default title
optional: pattern to use; pass an empty string ("") to have all files displayed (defaults to "")
optional: mode to use; either #REQ_NORMAL, #REQ_SAVEMODE or #REQ_MULTISELECT (defaults to #REQ_NORMAL) (V2.0)
optional: initial directory for the file requester (defaults to "" which means current directory) (V3.0)
optional: initial file for the file requester (defaults to "" which means no file) (V3.0)
the user's selection or an empty string if he cancelled the requester; if the requester was opened in multi-select mode, a table containing all files will be returned
f$ = FileRequest("Select a picture","png|jpg|jpeg|iff|pcx|bmp")
If f$ = ""
  Print("Requester cancelled!")
  Print("Your selection:", f$)
Ask the user for a file and print its name.

files = FileRequest("Select some files", "*", #REQ_MULTISELECT)
If files[0] = ""
  Print("Requester cancelled!")
  NPrint("Path:", PathPart(files[0]))
  NPrint("Files selected:", ListItems(files) - 1)
  While files[c] <> ""
    c = c + 1
The code above opens a multi-select file requester and prints all the files which the user selected.

Show TOC