I have a terrible memory and so I like using technology to remind myself to check my calendar and Todo list. I haven’t played a lot with Office command line but recently thought wouldn’t it be kewl to fire up OneNote and Outlook twice a day so that I check my calendar and todo list. I wanted my Calendar/Todo to fire up at 9.30am and 1.30pm so that I make sure I put my eyes on what I have ahead of me at least twice a day.
I chose scheduled tasks to using the vanilla Windows Task Scheduler. The plan is to use a trigger that fires off at 9.30am and 1.30pm and kicks off a program to fire up Outlook to calendar view, and OneNote to a targeted page.
Batch file to fire up OneNote
Before creating my scheduled task, I decided to create a batch file to kick off firing up OneNote. I was only really doing this because I could, so no real major driver here. I just decided to call a .cmd file rather than kick off the OneNote.exe in the scheduled task.
In the batch file I added the commands:
start /d “C:\Program Files (x86)\Microsoft Office\root\Office16” OneNote.exe “/hyperlink ‘https://somesite.sharepoint.com/personal/myaccountsite/Documents/OneNote/ProD-TSP/ProD-TSP/ToDo.one'”
You can see here I am starting OneNote and actually firing up a OneNote page that I have saved in Sharepoint. That way OneNote starts in my Todo page I have in OneNote. I saved my batch file in the C:\SRM\BIN folder as todo.cmd.
Scheduling the Task
So with Windows 10 (and Windows 8 and I believe Windows 7), we have a task scheduler which can be used to kick off functions at scheduled times. It’s pretty handy for what I am trying to do. In Windows 10, just search for “Task Scheduler”.
Once in Task Scheduler, click the “Create Basic Task” option from the actions menu (on right pane).
You can follow the bouncing ball through the wizard for creating. Point the action at the batch file c:\srm\bin\todo.cmd (or path where you created your batch file).
Once you have finished creating the task, let’s go through it and refine a little.
On the first page of the task, make sure that the task is only run when the user is logged on “Run only when user is logged on”, we obviously don’t need to run when not logged in.
In the action section, I am going to open Outlook in my calendar view as a separate program. Mostly because I wanted to show running an .exe and .cmd from the task scheduler to demonstrate different ways of use the task scheduler. So to add the Outlook.exe fire up, click on the New button. Add the program as “c:\Program Files (x86)\Microsoft Office\root\Office16\outlook.exe” and “Add Arguments” as /select outlook:calendar. You’ll need to use dbl quotes around the program path as the path as spaces in it.
You’ll end up having two actions like shown below.
The Schedule (Triggers)
One of the important options will be to set the weekly schedule. In the schedule tab click on the schedule you have setup in the wizard. I use two weekly schedules, and set the first to run at 9.15am on Mon-Frid, and the second at 1.15pm. You could potentially play with the Repeat task every “x hours” option rather than 2 different schedules.
So this is what my triggers ended up looking like.
I usually change the Settings tab as well, to make sure the tasks get killed if running for more than 1 hour.
So after a bit of bing’ing and a bit of playing around with it this is what I came up with.
Hopefully that helps other people with a terrible memory like me J.