version 6.0.5
AP Select document (path; types) Longint
| Parameter | Type | Description | |
| path | Text | Complete path to the file | |
| types | Text Array|String Array | List of file types | |
| Function result | Longint | Error code |
Description
AP Select document displays a standard Open file dialog box that allows the user to select a file. Once the choice is validated, the path variable contains the complete access path to the selected file and the function returns 1.
The maximum length of the stored path is 1024 characters.
Unlike Open document, AP Select document does not open the document; it only stores the file complete path.
You can specify up to 16 document types in the types array. In this case, only the files that belong to the specified types are displayed in the Open file dialog box. If the types list is an empty array, all types of document will be displayed in the Open file dialog box.
On Windows, the type of a document is designated by its extension.
On Mac OS, the type of a document is designated by four characters.
Examples
1. The user can choose any type of document:
ARRAY TEXT($types;0) $ok:=AP Select document($path;$types) If($ok=1) ProcessDoc($path) End if
2. Limiting the file type choice on Mac OS:
`Restricting the choice to the AIFF file type (system sound)
ARRAY TEXT($types;2)
$types{1}:="sfil"
$types{2}:="AIFF"
$path:=""
$ok:=AP Select document($path;$types)
If($ok=1)
ProcessSoundFile($path)
End if
3. Limiting the file type choice on Windows:
`Restricting the choice to the .WAV or .AIF file types (sound types)
ARRAY TEXT($types;2)
$types{1}:="WAV"
$types{2}:="AIF"
$path:=""
$ok:=AP Select document($path;$types)
If($ok=1)
ProcessSoundFile($path)
End if