ObjectStore Reference
The ObjectStore is a cross‑engine storage system that allows macros, templates, JScript.NET, JavaScriptV8, and PowerShellScript blocks to share values. It is ideal for passing data between engines, maintaining state across macro calls, and coordinating complex workflows.
Overview
ObjectStore is available in all scripting engines:
- JScript.NET
- JavaScriptV8
- PowerShellScript
- Template Language
Values stored in the ObjectStore persist for the duration of the macro execution session and can be retrieved by any engine or nested macro.
Functions
addToObjectStore(key, obj)getFromObjectStore(key)
Both functions are available in:
- JScript.NET
- JavaScriptV8
- PowerShellScript
- Template Language (via
[!SET]/[!VAR])
Storing Values
Store any value using a string key:
JScript.NET
addToObjectStore("hello", 123);
JavaScriptV8
addToObjectStore("hello", 123);
PowerShellScript
addToObjectStore "hello" 123
Template Language
[!SET]hello[!TO]123[!/SET]
Retrieving Values
JScript.NET
var value = getFromObjectStore("hello");
JavaScriptV8
var value = getFromObjectStore("hello");
PowerShellScript
$value = getFromObjectStore "hello"
Template Language
[!VAR]hello[!/VAR]
Cross‑Engine Example
This example shows storing a value in Template Language and retrieving it from all engines.
[!SET]hello[!TO]123[!/SET]
Template Language: [!VAR]hello[!/VAR]
[!POWERSHELLSCRIPT]
$someVar = getFromObjectStore "hello"
"PowerShellScript: " + $someVar
[!/POWERSHELLSCRIPT]
[!JAVASCRIPTV8]
var jsTest = getFromObjectStore("hello");
writeln("JSV8: " + jsTest);
[!/JAVASCRIPTV8]
[!JSCRIPT]
var jsTest = getFromObjectStore("hello");
writeln("JScript: " + jsTest);
[!/JSCRIPT]
Use Cases
- Sharing values between JScript.NET, V8, and PowerShellScript blocks
- Passing state between scripting engines
- Storing counters, flags, or configuration values
- Coordinating multi‑engine workflows
- Persisting values during template execution
Notes
- Keys are case‑sensitive.
- Values persist for the duration of the macro execution session.
- Values may be any type supported by the engine (strings, numbers, objects, arrays, .NET objects).
- ObjectStore is not persisted to disk — it is runtime‑only.