IAppScripting#
Fully qualified name: omni::kit::IAppScripting
Defined in omni/kit/IApp.h
-
class IAppScripting#
Scripting Engine interface.
Public Functions
- virtual bool executeString(
- const char *str,
- const char *commandName = nullptr,
- bool executeAsFile = false,
Run script from a string.
A kGlobalEventScriptingCommand event is always dispatched before executing the script.
- Parameters:
str – Content of the script to execute
commandName – (optional) A command name that will logged for multi-line scripts
executeAsFile – If
true
,str
is first written to a temporary file which is then executed. The file is not removed which allows inspecting the script at a later point.
- Return values:
true – if execution was successful
false – if an error occurs (kGlobalEventScriptingStdErr was dispatched with the error message)
- virtual bool executeFile(
- const char *path,
- const char *const *args,
- size_t argCount,
Run script from a file.
A kGlobalEventScriptingCommand event is always dispatched before executing the script.
- Parameters:
path – The path to the script file. May be a file name that exists in folders that have been added to the search path with addSearchScriptFolder(). A “.py” suffix is optional.
args – An optional array of string arguments to pass to the script file
argCount – The number of arguments in the
args
array
- Return values:
true – if execution was successful
false – if the file was not found (an error is logged), or the script could not be loaded (an error is logged), or execution failed (kGlobalEventScriptingStdErr was dispatched with the error message)
-
virtual bool addSearchScriptFolder(const char *path) = 0#
Adds a folder path that will be searched for scripts.
Calls to executeFile() will search the paths added in the order that they were added.
See also
Note
If the given
path
does not exist it will be created.- Parameters:
path – A relative or absolute path. If the path does not exist it will be created.
- Return values:
true – The given
path
was added to the list of search pathsfalse – The given
path
already exists in the list of search paths
-
virtual bool removeSearchScriptFolder(const char *path) = 0#
Removes a folder from the list of folders that will be searched for scripts.
See also
- Parameters:
path – A relative or absolute path which was previously passed to addSearchScriptFolder()
- Return values:
true – The given
path
was found and removed from the list of script search foldersfalse – The given
path
was not found in the list of script search folders
-
virtual carb::events::IEventStream *getEventStream() = 0#
Access the scripting event stream.
Warning
This function is deprecated in favor of Events 2.0 using carb.eventdispatcher.plugin with named events (i.e. kGlobalEventScriptingCommand, kGlobalEventScriptingStdOut, kGlobalEventScriptingStdErr).
- Returns:
a carb::events::IEventStream that receives scripting events