SAHI Plugin - Converters


From file to script.sahi

Category-name : script

What ?

This script converter will convert a file type resource to a script.sahi type resource.

Two cases :

Standalone Sahi script

In the case of a standalone script, it doesn’t depend on other files (e.g. other sahi script to be included or files to be downloaded). The initial resource references the sahi script. You could use the syntax below :

CONVERT {scriptToConvert<Res:file>} TO script.sahi (script) AS {converted<Res:script.sahi>}

> Input :

  • {scriptToConvert<Res:file>} : The name of the resource to convert (file type resource). This ressource references a sahi script (e.g. by using a LOAD instruction on the sahi script path).

> Output :

  • {converted<Res:scipt.sahi>} : The name of the converted resource (script.sahi type resource).

Example :

LOAD path/to/sahi_script.sah AS sahi_script.file

CONVERT sahi_script.file TO script.sahi (script) AS sahi_script.sahi



Sahi script with dependencies

In the case of a script which depends on other file, you have to use the syntax below. The initial resource references a directory. This directory should contains in its tree the whole resources needed by the main sahi script. You also have to define where is the main sahi script to execute (mainScriptPath of the USING clause). This path should be RELATIVE to the directory referenced by the initial resource.

CONVERT {rootDirectory<Res:file>} TO script.sahi (script) AS {converted<Res:script.sahi>} USING {mainScriptPath<Res:file>}

> Input :

  • {rootDirectory<Res:file>} : Name of the resource which references the root directory. This root directory should contain the whole files needed to execute the sahi script.
  • {mainScriptPath<Res:file>} : Name of the configuration resource. The content of the file should be : ‘mainpath:relativePathToMainSahiScript’ (Note : you could use an inline definition). This path to main sahi script should be relative to the directory given as rootDirectory.

> Output :

  • {converted<Res:scipt.sahi>} : The name of the converted resource (script.sahi type resource).

Example :

LOAD path/to/rootDirectory AS root_directory.file

CONVERT root_directory.file TO script.sahi (script) AS sahi_script.sahi USING $(mainpath:relative/path/to/main/sahi_script.sah)