DEV Community

Advantage Builder for AdvantageBuilder

Posted on • Edited on

Automating Workflows with AdvantageBuilder: UI Helpers, Database Access, ObjectStore, HTML Forms, and Macro Orchestration

Most scripting tools give you one language and a sandbox. AdvantageBuilder gives you three scripting engines, a shared object store, WinForms UI helpers, database execution, HTML form hosting, and macro orchestration — all wrapped in a macro system designed for real Windows automation.

AdvantageBuilder — The Universal Automation Platform

AdvantageBuilder — The Universal Automation Platform

This article walks through a mix of actual AdvantageBuilder features, using only the wrapper functions defined in your setup scripts and helper modules.

Everything shown here is real AdvantageBuilder code.

1. Building WinForms UI with WinFormsHelper (PowerShell)

AdvantageBuilder includes a full WinForms helper module that lets you build Windows Forms without touching .NET boilerplate.

Here is what real AdvantageBuilder UI code looks like:

using module "[PSModuleLibrary]\WinFormsHelper.psm1"

$winformsHelper = [WinFormsHelper]::new()

$mainForm = $winformsHelper.CreateForm('Form Title')

$txtTextBoxName = $winformsHelper.AddTextBox($mainForm, "TextBox Label", "Joe")

$lstListBoxName = $winformsHelper.AddListBox($mainForm, "ListBox Label", @('Option 1','Option 2', 'Option 3'), "Option 2")
$lstListBoxName.SelectionMode = "MultiExtended"

$cboComboBoxName = $winformsHelper.AddComboBox($mainForm, "ComboBox Label", @('Option 1','Option 2', 'Option 3'), "Option 2")

$chkCheckBoxName = $winformsHelper.AddCheckBox($mainForm, "CheckBox Label", $false)

$txtMultiLineTextBoxName = $winformsHelper.AddTextBox($mainForm, "Paragraph")
$winformsHelper.SetToMultilineTextBox($txtMultiLineTextBoxName, 60, 120)

$rbRadioButtonName1 = $winformsHelper.AddRadioButton($mainForm, "RadioButton1 Label", $false)
$rbRadioButtonName2 = $winformsHelper.AddRadioButton($mainForm, "RadioButton2 Label", $false)
$rbRadioButtonName3 = $winformsHelper.AddRadioButton($mainForm, "RadioButton3 Label", $true)

$winformsHelper.FinaliseDialogForm($mainForm)

if($mainForm.ShowDialog() -eq [System.Windows.Forms.DialogResult]::OK)
{

}

$winformsHelper.CleanUpForm($mainForm)
Enter fullscreen mode Exit fullscreen mode

2. Executing Database Commands (JavaScript)

Your setup scripts expose database wrappers such as:

  • ExecuteDataset
  • ExecuteNonQuery
  • ExecuteDatasetXML
  • ExecuteBatchTran

Example:

var ds = ExecuteDataset("SELECT TOP 5 * FROM Customers");
writeln("Rows returned: " + ds.Tables[0].Rows.Count);
Enter fullscreen mode Exit fullscreen mode

Updating data:

ExecuteNonQuery("UPDATE Customers SET Active = 1 WHERE CustomerID = 123");
alert("Customer activated.");
Enter fullscreen mode Exit fullscreen mode

3. Sharing Data Between Engines (ObjectStore)

AdvantageBuilder’s ObjectStore lets JavaScript, PowerShell, and JScript.NET share values.

PowerShell:

$someVar = getFromObjectStore "hello"
"PowerShellScript: $someVar"
Enter fullscreen mode Exit fullscreen mode

JavaScriptV8:

let jsTest = getFromObjectStore("hello");
writeln("JSV8: " + jsTest);

JScript.NET:

var jsTest = getFromObjectStore("hello");
writeln("JScript: " + jsTest);
Enter fullscreen mode Exit fullscreen mode

These wrappers (addToObjectStore, getFromObjectStore) are part of your macro environment.

4. Hosting HTML Forms Inside Macros

Your setup scripts expose:

  • showHTMLForm
  • launchHTMLForm
  • loadHTMLDocument
  • Edge variants

Example:

var doc = showHTMLForm("Forms/CustomerForm.html");
alert("Form loaded: " + doc.title);

var doc2 = showHTMLForm("Forms/CustomerForm.html", { mode: "edit" });
Enter fullscreen mode Exit fullscreen mode

This is unique to AdvantageBuilder — you’re hosting HTML UI inside a macro engine.

5. Macro Orchestration with callMacro

AdvantageBuilder’s macro orchestration is built around two functions:

callMacro(showResults, macroName, macroPath, parametersObject)
callMacroAsync(showResults, macroName, macroPath, parametersObject)

Where:

  • All macros ALWAYS return a value
  • showResults = true → macro prints its own output
  • showResults = false → macro does not print output
  • Return value is ALWAYS available, regardless of showResults

Example 1 — Macro prints its own output, but still returns a value

// Example 1: About to call the 'Get a shopping list' macro.

var result1 = callMacro(true, "Get a shopping list", "Hello World\\Helper Macros");


// After calling the 'Get a shopping list' macro.
writeln("Returned value:");
writeln(result1);

Enter fullscreen mode Exit fullscreen mode

Example 2 — Macro does NOT print output, but returns the value

// Example 2: About to call the 'Get a shopping list' macro for the second time.


var result2 = callMacro(false, "Get a shopping list", "Hello World\\Helper Macros");

// After calling the 'Get a shopping list' macro for the second time.
writeln("Returned value:");
writeln(result2);
Enter fullscreen mode Exit fullscreen mode

Example 3 — Passing parameters to macros

var param = new Object();
param.x = 4;
param.y = 5;
param.sum = null;

// Example 3: About to call the 'Calculate Sum' macro with parameters

var result3 = callMacro(false, "Calculate Sum", "Hello World\\Helper Macros", param);

// After calling the 'Calculate Sum' macro with parameters

write(param.x + " + " + param.y + " = " + param.sum);

writeln("Returned value:");
writeln(result3);
Enter fullscreen mode Exit fullscreen mode

This is real AdvantageBuilder macro orchestration, using the exact function signature your engine exposes.

Final Thoughts

AdvantageBuilder isn’t a scripting toy — it’s a multi‑engine automation platform with:

  • WinForms UI via WinFormsHelper
  • Database execution via ExecuteDataset / ExecuteNonQuery
  • Cross‑engine data via addToObjectStore / getFromObjectStore
  • HTML UI via showHTMLForm
  • Macro orchestration via callMacro
  • JavaScript, PowerShell, and JScript.NET engines

Everything in this article is unique to AdvantageBuilder and comes directly from your setup scripts and helper modules.

Try AdvantageBuilder

You can download AdvantageBuilder — including the macro engine, WinFormsHelper, ObjectStore, database wrappers, and full documentation — from:

https://advbuilder.dev/

🚀 Download AdvantageBuilder

Top comments (0)