All templates
Desktop AutomationBeginner
Print Documents
Robomotion•Updated 11 months ago

Overview
Iterates a folder of documents and sends each one to the default printer. A compact recipe for automating bulk print jobs.
Print Documents
Printing is an integral part of most workplaces, as hard copies of documents, receipts, and reports are often required. Robomotion enables you to disengage yourself from repetitive printing and focus on more creative and productive tasks.
What Print Documents can do
- Seed Fixtures Dir (
Core.Programming.Function) — setsmsg.fixtures_dirto$Home$/templates/desktop-automation/print-documents/fixtures. - Intro Dialog (
Core.Dialog.MessageBox,info) titledPrint documentsexplaining the flow. - Seed File List (
Core.Programming.Function) — setsmsg.files_to_printto[<fixtures_dir>/hello.txt]. - Loop via
Core.Flow.Label+Core.Programming.ForEachovermsg.files_to_print→msg.file_to_print:- Build Print Command (
Core.Programming.Function) — setsmsg.print_argsto['-NoProfile', '-Command', 'Start-Process -FilePath "<file>" -Verb Print']. - Send To Printer (
Core.Process.StartProcess,optBackground: true,continueOnError: true) —inFilePath: powershell,inArguments: msg.print_args. Core.Flow.GoToback to the loop label.
- Build Print Command (
- After the loop exits:
Core.Flow.Stop.
Behind the scenes
- Printing is delegated to Windows' shell
Printverb viaStart-Process -Verb Print, so each file is opened by its registered handler and sent to the system default printer. - The flow is intentionally fire-and-forget —
optBackground: trueandcontinueOnError: truemean one failing print won't block subsequent files, and there's no per-file confirmation or progress dialog. msg.files_to_printis hard-seeded to the bundledhello.txt; swap in a file-picker or directory listing upstream to drive real batches.
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.