Scheduling reports with Windows Task Scheduler

The Windows Task Scheduler can be used to schedule ActivReporter reports to run on a regular basis.

Prerequisites

In order to use Windows Task Scheduler to run ActivReporter reports, a user account with access to the ActivReporter database and to the reports that need to be scheduled is necessary. If the reports will be e-mailed, the user account must also have Outlook set up (or another messaging API [MAPI]).

Schedule Reports

  1. Open Task Scheduler. To access Task Scheduler, open Control Panel and go to Administrative Tools > Task Scheduler.

  2. In the Actions pane, click Create Task.... The Create Task dialog box opens.

  3. On the General tab, in the Name field, enter a name for the task.
  4. In the Security options section, ensure that a qualified user account is selected for running the task. If you need to specify a different user, click Change User or Group to select another user.
  5. Select the Run whether user is logged on or not option.

  6. Select the Triggers tab.

  7. Click New. The New Trigger dialog box opens.

  8. In the Begin the task field, ensure that "On a schedule" is selected.
  9. In the Settings section, select the frequency with which to run the task and specify a start date and time.
  10. In the Advanced settings section, configure the task according to your needs.
  11. If you want the task to be active immediately, ensure the Enabled checkbox is marked.

  12. Click OK to close the New Trigger dialog box.
  13. Select the Actions tab.

  14. Click New. The New Action dialog box opens.

  15. In the Action field, ensure that "Start a program" is selected.
  16. In the Program/script field, enter the path and file name of or browse to the script program that supports the script file you need to run; for example, cscript.exe for .vbs files.
  17. In the Add arguments (optional) field, enter the path to the script file that needs to execute along with any additional arguments to pass to the command.

    Example

    /NOLOGO c:\Data\MyActivity\DailyReportsScript.vbs

  18. Click OK to close the New Action dialog box.
  19. Click OK to close the Create Task dialog box.

Sample Visual Basic Script File

This sample Visual Basic script file will cause a trial balance to be e-mailed and then also printed to the default printer.

Set activity = CreateObject("ActivityOAS.Activity")
activity.ServerAddress = "appserver1"
activity.Connect
Set company = activity.Companies("MyCompany")
company.Connect
company.RunReport "General Ledger", _
 "Trial Balance Report", _
 "<p>" & _
 "<Answer Name='Trial Balance' Type='Shared'/>" & _
 "<Email UseTags='False' SeparatePages='False' " & _
 "ToAddress='pjohnston@AccountingWare.com' " & _
 "Subject='MyCompany Trial Balance' " & _
 "Prompt='False'/>" & _
 "</p>"
company.RunReport "General Ledger", _
 "Trial Balance Report", _
 "<p>" & _
 "<Answer Name='Trial Balance' Type='Shared'/>" & _
 "<Print/>" & _
 "</p>"