Task File Handling
KosmicTask permits the contents of any number of files to be passed as inputs and/or returned as results. File contents are passed as inputs using the File input type. When the task is executed the file contents are transferred to the target machine and temporarily stored. The path to this temporary file is passed as the actual task input parameter enabling the task to access the file data.
File contents are returned as results by returning a dictionary type result that contains a kosmicFile key defining the file or files whose contents are to be returned to the user. KosmicTask examines all results for the presence of the kosmicFile key and automatically sends the contents of any identified files back to the user as part of the total result.
Temporary File Handling
A task may return the contents of a pre existing file as a result or it may wish to return the contents of a temporary file that has been generated by the task. To assist with this KosmicTask provides a number of ways of requesting temporary file storage. File storage allocated in this way will only exist for the lifetime of the task and will be deleted from the host machine when the task terminates. A path to a temporary file or files may be requested in three different ways dependent on the nature of the scripting language plug-in.
- Command line based scripting languages simply need to create files in the task's initial working directory.
- Most in process tasks can call the resultFileWithName function on a KosmicTask supplier controller object to obtain a temporary path.
- Scripts which send Apple events can send the result file with name <basename> command to the KosmicTask application object.
The easiest way to determine what method to use for a particular scripting language is to examine the 'file' or 'files' template or read the usage document in the Resource Browser.