class _rrPython_CrossBatch

Parent Previous Next





_rrPython_CrossBatch is a simple class to create batch/script files for multiple OS at the same time.

It keeps a list of variables that will be replaced with values if you save a batch file.







Class _rrPython_CrossBatch functions:

Return type

Name

Description


add(string text)

Adds text to the current line


addFlag(string text)

Add a commandline flag to the current line. 

It automatically adds " " around the flag.


addEnd()

Adds a line end.


addLine(string text)

Adds the text to the current line and a line end.


setBaseFileName(string filename)

Set the base path+filename of the resulting file. Do not include any extension.


osVarAdd  (string &uni,  string &win,  string &linux, 

                             string &osx)

Adds variables and values to the replacement list. the parameter uni should not include the surrounding < > that you use in your commandlines.


There are already a few variables added by default:

uni

win

linux

osx

  rrBin

  %rrBin%

  ${rrBin}

  ${rrBin}

  RR_ROOT

  %RR_ROOT%

  ${RR_ROOT}

  ${RR_ROOT}

  comment

  @rem

  #

  #



setEnvVar  (string &name,  string &win,  string &linux, 

                             string &osx)

Set the environment variable "name" to the value specified.

bool

saveWin()

Saves the batch file for Windows. Returns false if the file could not be saved.

bool

saveOsx()

Saves the script file for Osx. Returns false if the file could not be saved.

bool

saveLx()

Saves the script file for Linux. Returns false if the file could not be saved.

String

getOSFileName(int OSID)

Return the batch filename for 0: Windows, 1: Linux or 2: OSX

String

fileErrorMessage()

Returns the error message in case a save has failed.


addCommentLine(string text)

Adds a comment line to the script. This line is not executed.


addCondition(string var1, string condition, string var2)

Adds an   "if var1 <condition> var2 then " expression to the shell script.

Do not forget to add the endif later!

Available values for the condition string are:

"contains"  
Important: If you use "contains", you have to add an "Else" to your script. Otherwise RR recognizes the render as failed if the condition failed

"equal"

"unEqual"

"larger"

"smaller"

"largerEqual"

"smallerEqual"





addConditionElse()

Adds an "else" to the shell script.


addConditionEndif()

Adds the "endif" to the batch file.