Oasys.REPORTER functions¶
- Batch()¶
This method can be used to test whether REPORTER is running in batch mode or not
- Returns:
True/False
- Return type:
bool
Example
To check if REPORTER is running in batch mode
if Oasys.REPORTER.Batch(): print("Running in batch mode.")
- Debug(string)¶
Print a string to log file for debugging. Anything that you call the debug method on will be ‘printed’ to the log file window. Note that a carriage return will automatically be added
- Parameters:
string (Any valid javascript type) – The string/item that you want to debug
- Returns:
No return value
- Return type:
None
Example
To print string “Hello, world!” to the debug log file
Oasys.REPORTER.Debug("Hello, world!")
- GetCurrentDirectory()¶
Return the current working directory for REPORTER
- Returns:
string
- Return type:
str
Example
To return the current directory
dir = Oasys.REPORTER.GetCurrentDirectory()
- LogError(message)¶
Print an error to log file. Anything that you print will be output to the log file window in bold red text. Note that a carriage return will automatically be added
- Parameters:
message (Any valid javascript type) – The string/item that you want to print
- Returns:
No return value
- Return type:
None
Example
To give error “Error: something has gone wrong” to the log file
Oasys.REPORTER.LogError("Error: something has gone wrong")
- LogPrint(message)¶
Print a string to log file. Anything that you print will be output to the log file window. Note that a carriage return will automatically be added
- Parameters:
message (Any valid javascript type) – The string/item that you want to print
- Returns:
No return value
- Return type:
None
Example
To print string “Hello, world!” to the log file
Oasys.REPORTER.LogPrint("Hello, world!")
- LogWarning(message)¶
Print a warning to log file. Anything that you print will be output to the log file window in red text. Note that a carriage return will automatically be added
- Parameters:
message (Any valid javascript type) – The string/item that you want to print
- Returns:
No return value
- Return type:
None
Example
To give warning “Warning: something has gone wrong” to the log file
Oasys.REPORTER.LogWarning("Warning: something has gone wrong")
- SetCurrentDirectory(directory)¶
Set the current working directory for REPORTER
- Parameters:
directory (string) – The directory that you want to change to
- Returns:
True if successful, False if not
- Return type:
bool
Example
To set the current directory to C:temp
status = Oasys.REPORTER.SetCurrentDirectory("C:\\temp")
- System(string)¶
Do a system command outside REPORTER
- Parameters:
string (Any valid javascript type) – The system command that you want to do
- Returns:
integer (probably zero if command successful but is implementation-dependant)
- Return type:
int
Example
To make the directory “example”
Oasys.REPORTER.System("mkdir example")