JavaScript Developer Reference
The SetupJS runtime provides the scripting environment used by AdvantageBuilder macros and templates. It supports both JScript.NET (VSA) and ClearScript V8 engines, exposing a unified API surface for database access, UI interaction, HTML forms, macro execution, JSON handling, ObjectStore, and .NET/COM interop.
Overview
AdvantageBuilder’s JavaScript runtime is a hybrid environment supporting:
- JScript.NET (Windows VSA engine)
- ClearScript V8 (modern JavaScript engine)
Both engines expose the same AdvantageBuilder API surface, allowing macros and templates to run consistently regardless of engine choice.
Error Handling
logMacroError(message, name)
Output
write(text)writeln(text)writeToFile(filePath, clearOutput)
User Interaction
alert(message)confirm(message)prompt(message, defaultValue)prompt2(title, message, defaultValue)
Timing / Event Loop
wait(seconds)doEvents()
Database Access
ExecuteNonQuery(cmd, connType, connString)ExecuteDataset(cmd, connType, connString)ExecuteDatasetXML(cmd, connType, connString)ExecuteBatchTran(commands, connType, connString)setDataRowValue(row, col, val)
HTML Forms (IE Engine)
showHTMLForm(url, params)launchHTMLForm(url, params)loadHTMLDocument(url, params)
HTML Forms (Edge Engine)
showHTMLFormEdge(url, script, params)launchHTMLFormEdge(url, script, params)loadHTMLDocumentEdge(url, script, params)
Clipboard
getClipboardData()setClipboardData(data)
GUI / Editor / Status
getGUIFilePath(fileName, path)browseFolders(initialPath)showEditor(text, caption, filePath)updateProgress(percentage)setStatusText(text)
Dataset / Data
createDataSet()
Macro Execution
callMacro(displayResult, macroName, macroPath, args)callMacroAsync(displayResult, macroName, macroPath, args)createMacro(macroName, macroPath, sourceCode)setMacroToRunAsync(macroName, macroPath, runAsyncAsDefault)getSourceCode(macroName, macroPath, classNameToInstantiate)
Variables
getVariable(key)
ObjectStore
addToObjectStore(key, obj)getFromObjectStore(key)
.NET / COM Interop
createActiveXObject(progId)createInstance(typeName, parameters)addAssembly(name)loadAssembly(name)loadAssemblyFrom(file)getTypeProxy(typeName)getEnum(typeName)getCurrentConnection()getLogger()
JSON
formatJSONText(value)jsonStringify(value, replacer, space)jsonSerializeObject(obj)jsonDeSerializeObject(str)
Macro Scheduler
addMacroSchedule(name, path, recurrenceType, referenceFrequency, recurrenceDetail, timeOfDay)removeMacroSchedule(scheduleId)
Macro GUI
showMacroGUI(obj)
Interop Helpers
toStringArray(arr)
Metadata Constructors
ColumnParameterInput