How to schedule a Sage 300 CRE macro to run unattended

Background

Sage 300 Construction and Real Estate allows users to create macros that can contain a set of tasks to be executed together. This feature is often used to run sets of reports or perform other recurring tasks involving multiple steps (i.e., such as period-end or month-end tasks). In connection with Sage Office Connector Import or Event 1 Software's Integrator products, this feature is often used to automate import tasks that enter new data into Sage 300 CRE.

Preparation

This article does not cover the steps to create Sage 300 CRE macros. That information can be found within the Sage application help system. In order for a Sage 300 CRE macro to run unattended (i.e., on a scheduled basis), the macro must be created in such a way that it will not display any prompts that a user must respond to. For example, if the output of a given task produces a report and you want the report to be stored in a print file (or PDF), you must specify the name of the print file otherwise Sage will prompt for file name when the macro is run. Before proceeding with the steps below, confirm that when the macro is run, there are no prompts displayed that a user must respond to.

Steps
  1. Open Windows Task Scheduler. (This is normally found under All Programs / Accessories / System Tools).
  2. In the Actions pane, click Create Task. The Create Task window will open with the General tab selected.
  3. In the Name box, type a name for the scheduled operation (e.g., "Import Sage Estimates")
  4. Under Security Options, select Run whether user is logged on or not.
  5. Check the Run with highest privileges box.
  6. Click the Triggers tab and click New to display the New Trigger window. Select the desired options in this window to define the time and schedule for the unattended operation and then click OK
    Note - You may want to initially set the start time to a time in the very near future for testing purposes.
  7. Click the Actions tab and click New to display the New Action window.
  8. Leave the Action drop-down set to Start a program.
  9. In the Program/script box, type (or select by clicking Browse) the following path:
    "C:Program Files (x86)Timberline OfficeSharedtsObject.exe"
  10. In the Add arguments (optional) box, enter the full path of the Sage 300 CRE macro enclosed in double quotes, followed by the Sage 300 CRE user name and password. Example -
    "\AccountingServerTimberline OfficeDataABC CompanyImportEstimates.mac" john jspwd123
  11. In the Start in (optional) box, type the full path of the Sage 300 CRE data folder. Example -
    \AccountingServerTimberline OfficeDataABC Company
    Note - This step is required in order to prevent Sage 300 CRE from displaying a data folder selection prompt when the task starts.
  12. Click OK
  13. Click OK again to save the task.
Example Action (click to enlarge)
task_scheduler_edit_action

Notes

  • It is suggested that you test the unattended task by logging out of the computer that the task is set to run on. This way there is no interactive Windows user account in use at the time the task starts.
  • If a Sage macro that is being run unattended via Task Scheduler stops to prompt the user for input, no prompt will be displayed. Consequently, the task will hang indefinitely waiting for input that will never be provided. In this situation, if you display the Windows Task Manager window, you will see a tsObject.exe process listed on the Processes tab and it will not be utilizing any CPU. Tasks that are stalled in this manner can be stopped by clicking End Task.
  • You can confirm that the macro ran by opening the macro in Sage 300 CRE. Click the Tools menu and then Macros. Click Open to open the macro and then click Log to display its log. The log will identify the date and time that macro was last run and may contain other useful diagnostic information. Each task that the macro runs may also produce its own report that will assist in determining if the macro tasks ran as expected.