# Working with files

Use these commands to work with files and folders.

 Command Availability Arguments Purpose file.getFolderPath EXE folder identifier, variable Returns the full path to a special folder. file.extract EXE what to extract, where to extract, completeness Extracts the file to the hard drive. file.exec EXE Path to file Executes an application. If you specify the path to an avi, mpg, mp3, zip document or some other document, it will be opened in the default application associated with this type of files.

file.getFolderPath

This command returns the full path to one of the special folders on the hard drive. The 1st argument is one of the following folder identifiers:
CURAPP – The file system directory where the application is located.
TEMP – The file system directory for temporary files. The typical path is C:\Documents and Settings\username\Local Settings\Temp.
APPDATA - The file system directory that is used as a common repository for application-specific data. The typical path is C:\Documents and Settings\username\Application Data.
MYMUSIC - The file system directory that is used as a common repository for music files. The typical path is C:\Documents and Settings\username\My Documents\My Music.
MYPICTURES - The file system directory that is used as a common repository for image files. The typical path is C:\Documents and Settings\username\My Documents\My Pictures.
MYVIDEO - The file system directory that is used as a common repository for video files. The typical path is C:\Documents and Settings\username\My Documents\My Videos.

The second argument is the variable that will be assigned the full path to the folder with the trailing slash ‘/’ at the end.

The following script assigns the full path to the directory where the application is stored to the CurDir variable:

fscommand(“file.getFolderPath”, “CURAPP,CurDir”);

file.extract

This command extracts the file stored in the application to the hard drive. The 1st argument is the path to the file that should be extracted relative to the root of the compiled directory. The 2nd argument is the full path to where the file will be extracted to. The 3rd argument is the variable that will pass the completeness status. This completeness status can take the following values:
-2 – failed to extract: no such file in the application.
-1 – failed to extract: cannot write the file to the specified directory on the disk.
0..100 – file extraction progress in percent.
101 – extraction is complete.

The following script extracts the file SomeFile.gif and saves it to the file specified in the TargetFile variable notifying the ExtractMonitor variable about the extraction process:

fscommand(“file.extract”, “SomeFile.gif,”+TargetFile+”,ExtractMonitor”);

file.exec

Synonym for exec.