forked from livecode/livecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanswer-file-with-type.lcdoc
More file actions
60 lines (36 loc) · 3.33 KB
/
Copy pathanswer-file-with-type.lcdoc
File metadata and controls
60 lines (36 loc) · 3.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Name: answer file with type
Type: command
Syntax: answer file[s] <prompt> [with <defaultPath>] [with type <types> [or type <types> ...]] [titled <windowTitle>] [as sheet]
Summary: Displays a <file dialog box|standard file dialog> for the user to select a <file>.
Introduced: 2.6
OS: mac,windows,linux
Platforms: desktop,web
Security: disk
Example:
answer file "Select a file to delete:"
Example:
answer files "Select the files you wish to process:"
Example:
answer file "Input:" with "/Macintosh HD/"
Example:
answer file (field "Prompt") with type "LiveCode Stacks|rev|RSTK"
Example:
answer files "Select the images you wish to view:" with type "JPEG Images|jpg|JPEG" \
Parameters:
prompt (string): If you specify empty, no prompt appears.
defaultPath: The name and location of the folder whose contents are listed when the dialog box appears. If no defaultPath is specified, the dialog box lists the contents of the last folder you used with a file dialog box.
types: Use the types parameter to specify which files should appear and be available for selection. Each set of types is a return-delimited list of values of the form "tag|extensions|filetypes".
windowTitle: The windowTitle, if specified, appears in the title bar of the dialog box. If no windowTitle is given, the title bar is blank. (This parameter has no effect on Mac OS systems, because Mac OS file dialog boxes don't have a title bar.)
The result: If <types> are specified, the result function will return the tag of the corresponding type selected from the supplied drop-down list.
It: The absolute file path of the file the user chose is placed in the it <variable>. If the answer files form is used, a return-delimited list of such paths is placed in the it variable. If the user cancels the <dialog box|dialog>, the <it> <variable> is set to empty.
Description:
Use the <answer file> command when a <handler> needs the <file path> of a <file> before continuing.
The dialog box displayed is the same one most programs use for the "Open" command in the File menu.
>*Important:* The <answer file command> does not open the <file>. It only displays the dialog box and retrieves the path to the file the user specifies.
If more than one type is specified, a drop-down list containing the tags will be displayed allowing the user to select which types of files to display. (This list is always displayed on Windows systems).
If the as sheet form is used, the dialog box appears as a sheet on OS X systems. On other systems, the as sheet form has no effect and the dialog box appears normally. Attempting to open a sheet from within another sheet displays the second stack as a <modal dialog box> instead. To give a dialog box a prompt when using the as sheet form a non-empty title must be provided. This will cause the prompt to appear in the same place it would if as sheet was not being used.
If the systemFileSelector <property> is set to false, LiveCode's built-in <dialog box> is used instead of the operating system's <file dialog box|standard file dialog>.
Changes:
The answer file ... with type ... form was introduced in version 2.6.
References: answer file (command), answer file command (command), file (keyword), it (keyword), property (glossary), variable (glossary), handler (glossary), file dialog box (glossary), file path (glossary), modal dialog box (glossary), dialog box (glossary)
Tags: file system