f$ = FileRequest(title$[, pattern$, mode, defdir$, deffile$])
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
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
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
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
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
Starting with Hollywood 6.0 you can also set the flag
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.
f$ = FileRequest("Select a picture","png|jpg|jpeg|iff|pcx|bmp") If f$ = "" Print("Requester cancelled!") Else Print("Your selection:", f$) EndIfAsk the user for a file and print its name.
files = FileRequest("Select some files", "*", #REQ_MULTISELECT) If files = "" Print("Requester cancelled!") Else NPrint("Path:", PathPart(files)) NPrint("Files selected:", ListItems(files) - 1) While files[c] <> "" NPrint(FilePart(files[c])) c = c + 1 Wend EndIfThe code above opens a multi-select file requester and prints all the files which the user selected.