All templates
Desktop AutomationIntermediate
Print Current Week's Calendar
Robomotion•Updated 11 months ago

Overview
Generates an HTML page for the current week and sends it to the default printer. Useful for team dashboards or physical planning boards.
Print Current Week's Calendar
Desktop users usually have daily routines, such as printing their weekly calendar, that helps them keep themselves productive and organized. Create desktop flows that automate these repetitive tasks and make your workweek easier.
What Print Current Week's Calendar can do
- Build Paths (
Core.Programming.Function) — setsmsg.desktop_folderto<$Home$>\Desktopandmsg.image_pathto<desktop>\calendar.jpg. - Launch Outlook (
Core.Process.StartProcess,optBackground: true) — launchesOUTLOOK.EXEfromC:\Program Files\Microsoft Office\root\Office16→msg.outlook_pid. - Wait For Outlook (
Robomotion.WindowsAutomation.WaitWindow) — selector//Window[contains(@Name,"Outlook")],optCondition: appear,optTimeout: 60. - Switch To Calendar (
Robomotion.WindowsAutomation.SendKey) — sends{Ctrl}+2to the Outlook window. - Switch To Work Week View (
Robomotion.WindowsAutomation.SendKey,continueOnError: true) — sends{Ctrl}+{Alt}+2. - Wait For Repaint (
Core.Programming.Sleep,optDuration: 2). - Capture Window (
Robomotion.WindowsAutomation.Screenshot,optFullScreen: false) — saves the Outlook window tomsg.image_path. - Build Print Args (
Core.Programming.Function) — setsmsg.print_argsto['-NoProfile', '-Command', 'Start-Process -FilePath "<image>" -Verb Print']. - Send To Printer (
Core.Process.StartProcess,optBackground: true,continueOnError: true) —inFilePath: powershell,inArguments: msg.print_args. - Wait Print Spool (
Core.Programming.Sleep,optDuration: 4), then Delete Screenshot (Core.FileSystem.Delete,continueOnError: true). - Build Kill Args + Close Outlook (
Core.Process.StartProcess→taskkill /F /IM outlook.exe,continueOnError: true), thenCore.Flow.Stop.
Behind the scenes
- The "Switch To Work Week View" step uses
continueOnError: trueso the flow still proceeds on Outlook builds whereCtrl+Alt+2is absent or unbound. - The flow intentionally prints an image of the current Outlook window (via a screenshot sent through the shell
Printverb), not a vector export of the calendar. - A 2-second sleep after the view switch gives Outlook time to repaint before
Screenshotruns; a 4-second sleep after print keeps the image on disk long enough for the spooler to read it beforeDeleteremoves it. - Outlook is closed via
taskkill /F, so unsaved items in other Outlook windows would be lost — the flow assumes Outlook was launched solely for this run.
More desktop automation templates
See all 17 →- Every customer from a CSVThe Windows Recorder's customer task run for every row of a CSV file, each typed value replaced by the row's field, with a Catch that logs a row the app will not take and goes on with the next.
- Putting it togetherOne flow over three systems. Headless Chrome reads today's web orders from Acme ERP Web, the finance system is asked about each customer over Remote Desktop, and the orders with nothing overdue are entered into Acme ERP for Windows, line by line, with a report at the end.
- Reading from a Java applicationA flow that signs in to Acme ERP (Java Edition), reads a customer's credit limit and the fasteners in the product table, works out how many boxes of each the limit covers, and writes the answer to a CSV file.
- Reading over Remote DesktopA flow that logs on to Acme ERP over Remote Desktop, reads the outstanding and overdue totals off the Invoices screen with OCR, each anchored to its label, and writes the overdue share to a CSV file.
- Slow sessionsA flow recorded on a good Remote Desktop session that logs on and updates a customer's email, phone and notes in Acme ERP, and still gets every value right on a slow session that loses keystrokes.
- Windows dialogs and gridsA flow that signs in to Acme ERP for Windows, waits for its orders grid, reads it with Get Table Data, exports the orders on hold through the Save As dialog, and closes the app answering its "Save changes?" question.