Macro Scheduler Reference
The Macro Scheduler allows you to run macros automatically on a schedule. Schedules can be created and removed programmatically from JScript.NET, JavaScriptV8, and PowerShellScript using the SetupJS and SetupPS runtime APIs.
Overview
The scheduler supports daily, weekly, monthly, and custom recurrence patterns. Each scheduled macro runs independently of the UI and can execute synchronously or asynchronously, depending on how the macro is configured.
Scheduler Functions
Available in both JavaScript (SetupJS) and PowerShell (SetupPS):
addMacroSchedule(name, path, recurrenceType, referenceFrequency, recurrenceDetail, timeOfDay)removeMacroSchedule(scheduleId)
addMacroSchedule returns a GUID string representing the schedule entry. This GUID must be stored if you intend to remove the schedule later.
addMacroSchedule
Creates a new scheduled macro entry and returns a scheduleId (GUID string).
Parameters
- name – Macro name
- path – Macro folder path
- recurrenceType – Daily, Weekly, Monthly, or custom
- referenceFrequency – Frequency value (e.g., every 1 day, every 2 weeks)
- recurrenceDetail – Additional detail (e.g., specific day of week)
- timeOfDay – Time the macro should run
Example (JavaScript)
// Create schedule and capture the GUID scheduleId
var scheduleId = addMacroSchedule(
"Daily Report",
"Reports\\Automation",
"Daily",
1,
"",
"08:00"
);
// Later, remove the schedule using the GUID
removeMacroSchedule(scheduleId);
Example (PowerShell)
# Create schedule and capture the GUID scheduleId
$scheduleId = addMacroSchedule "Daily Report" "Reports\Automation" "Daily" 1 "" "08:00"
# Later, remove the schedule using the GUID
removeMacroSchedule $scheduleId
removeMacroSchedule
Removes an existing scheduled macro entry.
Parameters
- scheduleId – The GUID string returned by
addMacroSchedule
Example (JavaScript)
removeMacroSchedule("c2a4f3b1-9f8e-4c2d-9c3a-1a2b3c4d5e6f");
Example (PowerShell)
removeMacroSchedule "c2a4f3b1-9f8e-4c2d-9c3a-1a2b3c4d5e6f"
Use Cases
- Daily report generation
- Weekly database maintenance macros
- Monthly data exports
- Nightly ETL workflows
- Automated cleanup or monitoring tasks
Notes
- Scheduled macros run independently of the UI.
- Macros can be configured to run asynchronously.
- Schedules persist until removed.
- Scheduler entries are stored internally by AdvantageBuilder.
- Schedule IDs are GUID strings, not integers.