3.3.2.43 OGSFileName

This is an outdated way to run scripts and it SHOULD NOT BE USED. To run script files or portions of script files, use the run object.

Execute a script in a script file (.OGS) located in the current working directory by using the file name as if it were a command object. If a file is added to the working directory while Origin is open, you must use a dir command for Origin to recognize the file as a command object. The command can take up to five arguments. Arguments are passed as strings and an individual argument can contain spaces if protected by parentheses. The current working directory can be changed by cd X-Function command.

Syntax:

OGSFileName.SectionName [arg1 arg2 ... arg5]
OGSFileName [arg1 arg2 ... arg5]

In the special case where no SectionName is given then

  • Origin looks for a section named Main and executes it if found
  • If no Main section is found, but code exists at the beginning of the file without a section name, then that code is executed
  • Otherwise Origin does nothing and does not report an error

Examples:

The following example runs [MySection] section in MyScripts.OGS in the current directory with two arguments, aa and bb that are passed to the script as strings and received as %1 and %2:

MyScripts.MySection aa bb;

The following example runs the [Main] section code in MyScripts.OGS in the current working directory with two arguments aa and bb that are passed to the script as strings and received as %1 and %2:

myScripts aa bb;

See Also:

OGSFileName.SectionName (command), Run (object)

Run (command)