Often times you will need a script to run when no one is around to start it (i.e. overnight). Windows includes a reliable function to do this for you called “Task Scheduler”. With the task scheduler you can start your EMUE program at any time, and run a script with a couple of different options. Let’s take a look at the process.
Running EMUE Automatically with Task Scheduler
Step 1: Open the Task Scheduler
Type “Task Scheduler” directly into the start menu search bar, and click on the program when it comes up.
Step 2: Using the Wizard to create a task
Click on “Create Task…” to open the task scheduling wizard.
- On the “General” tab, give your task a name.
- If you like you can add a description, but it is not required.
- Make sure that the radio button next to “Run only when user is logged on” is selected. This means that the account you used when creating the task must be logged in to the computer for your scheduled script to run. It is okay to lock the computer, but if you log in with a different account or turn off the computer, the script will not launch. Check the box next to “Run with highest privileges”
- **Failing to select "Run only when user is logged on" will prevent the task scheduler from launching EMUE as it requires an active desktop to run
- Then, make sure you select the appropriate operating system in the “Configure For” dropdown.
Step 3: Setting Triggers
Next, click on the “Triggers” Tab and click the “New” button.
- Select the radio button next to how often you want your script to run.
- Next, select the options for the interval you chose.
- Daily – Start Date; Start Time; Interval of Days (ex. 3 would run every three days)
- Weekly – Start Date; Start Time; Interval of Weeks; Days during each week
- Monthly – Start Date; Start Time; Months to run; Day(s) to run by date OR relative date (ex “Third Saturday”)
- Click “OK” on the Edit Trigger dialog, and then click on the Actions tab.
Step 4: Creating a new “Action
Now, click “New” to add an action on the “Actions” tab.
- Ensure that the type of action is set to “Start a program”.
- Click the “Browse” button and then navigate to the EMUE program.
- Make sure that you select the EMUE executable and NOT a shortcut to the file.
- On 64 bit machines, the path to the EMUE program is: C:\ProgramFiles(x86)\DataboundSolutions\EMUE V4\EMUEV4.exe.
- On 32 bit machines the path will typically be:
- C:\ProgramFiles\DataboundSolutions\EMUE V4\EMUEV4.exe
- Once you have selected the executable, click “Open”.
- Next, we want to add “arguments” that will tell the scheduler how to run EMUE. These are commonly called “Switches”
- The first option tells the scheduler whether you would like the program to run in the normal sized window or in a small window. To add these, we will start with a forward slash (/) and add the appropriate keyword
- /autostartsmall – starts EMUE in a small window
- /autostartfile – starts EMUE in a normal-sized window
- Next, add the path to the script you wish to run. This can easily be obtained by finding the EMUE script in the appropriate folder and right clicking the file while holding the shift key. This will give you the “Copy as Path” option, which copies the full filepath to the clipboard. We can then simply paste the information into the field after our autostart switch
- After pasting the file path, make sure that there is a space between the switch and the filepath. (ex. /autostartfile "C:\EMUE\MainframeTest.emue")
- Click on “Okay” to finish creating the action to execute.
Note About Actions: Multiple scripts can be scheduled within one Task Scheduler "Action". Simply repeat this step for each script you would like to start at the same time. Once the task executes, scripts will be completed in the order they are entered into the actions tab. For example, Script 1 will start and complete, then script 2 will start and complete, etc. with each starting and completing before starting the next task in the list.
Step 5: Conditions and Settings
Next, set “Conditions” and “Settings” as appropriate to your situation. In general, you will need to decide on at least two options that are shown below on the settings tab:
- “Run task as soon as possible after a scheduled start is missed” – By selecting this option, the task will run as soon as possible should the computer accidentally be shut down or restarted when a script is scheduled to run.
- “Stop the task if it runs longer than:” – This option should be unchecked to allow EMUE to remain in debug mode until you are able to see the screen. Otherwise, the task may be closed and error reporting may not be sent correctly.
Step 6: Finishing Up
Lastly, click “OK” to finish scheduling the task. This completes the scheduling task and brings you back to the main screen. To verify that the task has been successfully scheduled, click on “Task Scheduler Library”, and then search for your task as shown below. From here you can edit or delete the task as necessary by right clicking on the task itself.
Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.