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 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

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

Example (JavaScript)


removeMacroSchedule("c2a4f3b1-9f8e-4c2d-9c3a-1a2b3c4d5e6f");
    

Example (PowerShell)


removeMacroSchedule "c2a4f3b1-9f8e-4c2d-9c3a-1a2b3c4d5e6f"
    

Use Cases

Notes