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
-
Open Task Scheduler. To access Task Scheduler, open Control Panel and go to Administrative Tools > Task Scheduler.
-
In the Actions pane, click Create Task.... The Create Task dialog box opens.
- On the General tab, in the Name field, enter a name for the task.
- 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.
-
Select the Run whether user is logged on or not option.
-
Select the Triggers tab.
-
Click New. The New Trigger dialog box opens.
- In the Begin the task field, ensure that "On a schedule" is selected.
- In the Settings section, select the frequency with which to run the task and specify a start date and time.
- In the Advanced settings section, configure the task according to your needs.
-
If you want the task to be active immediately, ensure the Enabled checkbox is marked.
- Click OK to close the New Trigger dialog box.
-
Select the Actions tab.
-
Click New. The New Action dialog box opens.
- In the Action field, ensure that "Start a program" is selected.
- 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.
-
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
- Click OK to close the New Action dialog box.
- Click OK to close the Create Task dialog box.
When running on a 32-bit system, use C:\Windows\System32\cscript.exe.
When running on a 64-bit system, use C:\Windows\SysWOW64\cscript.exe. (This causes the 32-bit version of cscript to be used so that it is compatible with ActivReporter Automation Services [AAS].)
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.
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>"