# IRiApp Interface Reference

Inherits IDispatch, and IDispatch.

List of all members.

## Public Member Functions
HRESULT | Shutdown (void)
HRESULT | Help (void)
HRESULT | Undo (void)
HRESULT | Redo (void)
HRESULT | RunScript ([in] BSTR fileName)
HRESULT | TimerActivate ([in] BSTR szTimerName,[in] RtUlong dwPeriod)
HRESULT | TimerDeactivate ([in] BSTR szTimerName)
HRESULT | ImportPackage ([in] BSTR bsPackageName)
HRESULT | RootCreate (void)
HRESULT | SetCachingMode ([in] BSTR cachingMode,[in] BOOL bUpdate)
HRESULT | CreateLogHandler ([in] BSTR clsid,[out, retval] RtUlong *pHandlerId)
HRESULT | DestroyLogHandler ([in] RtUlong handlerId)
HRESULT | Reset (void)
HRESULT | SendCustomEvent ([in] BSTR bsNodeName,[in] VARIANT vCustomData)
HRESULT | SuspendLogHandler ([in] RtUlong handlerId,[in] BOOL bSuspend)
HRESULT | SuspendLogHandlers ([in] BOOL bSuspend)
HRESULT | ClearHistory (void)
HRESULT | AllTimersDeactivate ([in] BSTR szEncapsName)
HRESULT | RunScriptBuffer ([in] BSTR Buffer)
HRESULT | AddPackageLoadPath ([in] BSTR bsPath,[in] BOOL bInsertToFront)
| Add new package load path.
HRESULT | EnableCrashReporting ()
| Enable crash reporting.
HRESULT | Shutdown (void)
HRESULT | Help (void)
HRESULT | Undo (void)
HRESULT | Redo (void)
HRESULT | RunScript ([in] BSTR fileName)
HRESULT | TimerActivate ([in] BSTR szTimerName,[in] RtUlong dwPeriod)
HRESULT | TimerDeactivate ([in] BSTR szTimerName)
HRESULT | ImportPackage ([in] BSTR bsPackageName)
HRESULT | RootCreate (void)
HRESULT | SetCachingMode ([in] BSTR cachingMode,[in] BOOL bUpdate)
HRESULT | CreateLogHandler ([in] BSTR clsid,[out, retval] RtUlong *pHandlerId)
HRESULT | DestroyLogHandler ([in] RtUlong handlerId)
HRESULT | Reset (void)
HRESULT | SendCustomEvent ([in] BSTR bsNodeName,[in] VARIANT vCustomData)
HRESULT | SuspendLogHandler ([in] RtUlong handlerId,[in] BOOL bSuspend)
HRESULT | SuspendLogHandlers ([in] BOOL bSuspend)
HRESULT | ClearHistory (void)
HRESULT | AllTimersDeactivate ([in] BSTR szEncapsName)
HRESULT | RunScriptBuffer ([in] BSTR Buffer)
HRESULT | AddPackageLoadPath ([in] BSTR bsPath,[in] BOOL bInsertToFront)
| Add new package load path.
HRESULT | EnableCrashReporting ()
| Enable crash reporting.
## Properties
RtUlong * | HistoryLength`[get, set]`
RtUlong | HistoryLength`[set]`
RtUlong * | HistoryLength`[get]`

## Detailed Description

The IRiApp interface provides kernel methods (serialization, undo, timer management, log management). Several of these are useful only at application startup time, or are reserved for internal purposes.
Root-level name in the scripting engine's name space: RsApp

## Member Function Documentation

HRESULT IRiApp::Shutdown | ( | void |  | ) |

Regular application shutdown.

        RsApp.ShutDown();

HRESULT IRiApp::Help | ( | void |  | ) |

Generates xml developer documentation of application's nodes and commands.

     RsApp.Help();

HRESULT IRiApp::Undo | ( | void |  | ) |

Performs undo operation.

     RsApp.Undo();

HRESULT IRiApp::Redo | ( | void |  | ) |

Performs redo operation.

     RsApp.Redo();

HRESULT IRiApp::RunScript | ( | [in] BSTR | fileName | ) |

Executes script from file (written in jScript). Used for application startup script.

Parameters:

  | fileName | [in] File name to be executed.

HRESULT IRiApp::TimerActivate | ( | [in] BSTR | szTimerName,
|  | [in] RtUlong | dwPeriod |
| ) |  |  |

Activates timer object.

Parameters:

  | szTimerName | [in] Full name of timer object.
  | dwPeriod | [in] Period for the timer's tick value in milliseconds.

        var owner = System.ThisOwner();
        var target = owner + '/Timer';
        RsApp.TimerActivate(target,200);

HRESULT IRiApp::TimerDeactivate | ( | [in] BSTR | szTimerName | ) |

Deactivates timer object.

Parameters:

  | szTimerName | [in] Full name of timer object.

        var owner = System.ThisOwner();
        var target = owner + '/Timer';
        RsApp.TimerDeactivate(target);

HRESULT IRiApp::ImportPackage | ( | [in] BSTR | bsPackageName | ) |

Imports specific package (usually during application startup).

Parameters:

  | clsidPck | [in] GUID of the package to be imported.

HRESULT IRiApp::RootCreate | ( | void |  | ) |

Creates system root (during application startup when no existing content is reloaded).

HRESULT IRiApp::SetCachingMode | ( | [in] BSTR | cachingMode,
|  | [in] BOOL | bUpdate |
| ) |  |  |

Sets caching mode for connectors (for internal purpose only!).

HRESULT IRiApp::CreateLogHandler | ( | [in] BSTR | clsid,
|  | [out, retval] RtUlong * | pHandlerId |
| ) |  |  |

Creates log handler instance (for internal purposes only!).

HRESULT IRiApp::DestroyLogHandler | ( | [in] RtUlong | handlerId | ) |

Destroys log handler instance (for internal purposes only!).

HRESULT IRiApp::Reset | ( | void |  | ) |

System reset operation.

        RsApp.Reset();

HRESULT IRiApp::SendCustomEvent | ( | [in] BSTR | bsNodeName,
|  | [in] VARIANT | vCustomData |
| ) |  |  |

Sends custom event to specific object (special way of communication between objects).

Parameters:

  | bsNodeName | [in] Full name of destination object.
  | vCustomData | [in] Custom data (e.g. specific signal number).

        var owner = System.ThisOwner();
        var target = owner + '/MyEvents';
        RsApp.SendCustomEvent(target,1);

HRESULT IRiApp::SuspendLogHandler | ( | [in] RtUlong | handlerId,
|  | [in] BOOL | bSuspend |
| ) |  |  |

Suspend or allow specific log handler (for internal purposes only!).

HRESULT IRiApp::SuspendLogHandlers | ( | [in] BOOL | bSuspend | ) |

Suspend or allow all registered log handlers (for internal purposes only!).

HRESULT IRiApp::ClearHistory | ( | void |  | ) |

Clear command history.

        RsApp.ClearHistory();

HRESULT IRiApp::AllTimersDeactivate | ( | [in] BSTR | szEncapsName | ) |

Deactivates all running timers (e.g. to stop all timer-based animations on the scene).

Parameters:

  | szEncapsName | [in] Scene/object name to deactivate all timers within.

        var owner = System.ThisOwner();
        RsApp.AllTimersDeactivate(owner);

HRESULT IRiApp::RunScriptBuffer | ( | [in] BSTR | Buffer | ) |

Executes script buffer.

Parameters:

  | Buffer | [in] Script code to be executed.

        RsApp.RunScriptBuffer('System.Alert("Script-buffer answering");');

HRESULT IRiApp::AddPackageLoadPath | ( | [in] BSTR | bsPath,
|  | [in] BOOL | bInsertToFront |
| ) |  |  |

Add new package load path.

HRESULT IRiApp::EnableCrashReporting | ( |  | ) |

Enable crash reporting.

HRESULT IRiApp::Shutdown | ( | void |  | ) |

Regular application shutdown.

        RsApp.ShutDown();

HRESULT IRiApp::Help | ( | void |  | ) |

Generates xml developer documentation of application's nodes and commands.

     RsApp.Help();

HRESULT IRiApp::Undo | ( | void |  | ) |

Performs undo operation.

     RsApp.Undo();

HRESULT IRiApp::Redo | ( | void |  | ) |

Performs redo operation.

     RsApp.Redo();

HRESULT IRiApp::RunScript | ( | [in] BSTR | fileName | ) |

Executes script from file (written in jScript). Used for application startup script.

Parameters:

  | fileName | [in] File name to be executed.

HRESULT IRiApp::TimerActivate | ( | [in] BSTR | szTimerName,
|  | [in] RtUlong | dwPeriod |
| ) |  |  |

Activates timer object.

Parameters:

  | szTimerName | [in] Full name of timer object.
  | dwPeriod | [in] Period for the timer's tick value in milliseconds.

        var owner = System.ThisOwner();
        var target = owner + '/Timer';
        RsApp.TimerActivate(target,200);

HRESULT IRiApp::TimerDeactivate | ( | [in] BSTR | szTimerName | ) |

Deactivates timer object.

Parameters:

  | szTimerName | [in] Full name of timer object.

        var owner = System.ThisOwner();
        var target = owner + '/Timer';
        RsApp.TimerDeactivate(target);

HRESULT IRiApp::ImportPackage | ( | [in] BSTR | bsPackageName | ) |

Imports specific package (usually during application startup).

Parameters:

  | clsidPck | [in] GUID of the package to be imported.

HRESULT IRiApp::RootCreate | ( | void |  | ) |

Creates system root (during application startup when no existing content is reloaded).

HRESULT IRiApp::SetCachingMode | ( | [in] BSTR | cachingMode,
|  | [in] BOOL | bUpdate |
| ) |  |  |

Sets caching mode for connectors (for internal purpose only!).

HRESULT IRiApp::CreateLogHandler | ( | [in] BSTR | clsid,
|  | [out, retval] RtUlong * | pHandlerId |
| ) |  |  |

Creates log handler instance (for internal purposes only!).

HRESULT IRiApp::DestroyLogHandler | ( | [in] RtUlong | handlerId | ) |

Destroys log handler instance (for internal purposes only!).

HRESULT IRiApp::Reset | ( | void |  | ) |

System reset operation.

        RsApp.Reset();

HRESULT IRiApp::SendCustomEvent | ( | [in] BSTR | bsNodeName,
|  | [in] VARIANT | vCustomData |
| ) |  |  |

Sends custom event to specific object (special way of communication between objects).

Parameters:

  | bsNodeName | [in] Full name of destination object.
  | vCustomData | [in] Custom data (e.g. specific signal number).

        var owner = System.ThisOwner();
        var target = owner + '/MyEvents';
        RsApp.SendCustomEvent(target,1);

HRESULT IRiApp::SuspendLogHandler | ( | [in] RtUlong | handlerId,
|  | [in] BOOL | bSuspend |
| ) |  |  |

Suspend or allow specific log handler (for internal purposes only!).

HRESULT IRiApp::SuspendLogHandlers | ( | [in] BOOL | bSuspend | ) |

Suspend or allow all registered log handlers (for internal purposes only!).

HRESULT IRiApp::ClearHistory | ( | void |  | ) |

Clear command history.

        RsApp.ClearHistory();

HRESULT IRiApp::AllTimersDeactivate | ( | [in] BSTR | szEncapsName | ) |

Deactivates all running timers (e.g. to stop all timer-based animations on the scene).

Parameters:

  | szEncapsName | [in] Scene/object name to deactivate all timers within.

        var owner = System.ThisOwner();
        RsApp.AllTimersDeactivate(owner);

HRESULT IRiApp::RunScriptBuffer | ( | [in] BSTR | Buffer | ) |

Executes script buffer.

Parameters:

  | Buffer | [in] Script code to be executed.

        RsApp.RunScriptBuffer('System.Alert("Script-buffer answering");');

HRESULT IRiApp::AddPackageLoadPath | ( | [in] BSTR | bsPath,
|  | [in] BOOL | bInsertToFront |
| ) |  |  |

Add new package load path.

HRESULT IRiApp::EnableCrashReporting | ( |  | ) |

Enable crash reporting.

## Property Documentation

RtUlong IRiApp::HistoryLength`[get, set]`

Gets current command history length.

Returns:
  pVal [out, retval] Returns history length.

        var histLength = RsApp.HistoryLength;
        System.Alert(histLength);

Sets command history length.

Parameters:

  | newVal | [in] New history length to be set.

        RsApp.HistoryLength()= 20;

RtUlong IRiApp::HistoryLength`[set]`

Sets command history length.

Parameters:

  | newVal | [in] New history length to be set.

        RsApp.HistoryLength()= 20;

RtUlong* IRiApp::HistoryLength`[get]`

Gets current command history length.

Returns:
  pVal [out, retval] Returns history length.

        var histLength = RsApp.HistoryLength;
        System.Alert(histLength);