SPB Git

Repository Public License

13-scheduled-window-screenshot.yaml 4.1 KB 100 lines yaml

1# =============================================================================2# SP BOUCHER | SOURCE FILE3# =============================================================================4# Project      : ORIX OS Automation5# File         : Workflows/Examples/13-scheduled-window-screenshot.yaml6# Author       : Simon-Pierre Boucher | https://spboucher.ai7# Contact      : support@spboucher.ai8# Copyright    : (c) 2026 Simon-Pierre Boucher9# License      : Proprietary, all rights reserved (see license file)10# =============================================================================11# END OF SP BOUCHER SOURCE HEADER12# =============================================================================1314# ORIX OS Automation15# File: Workflows/Examples/13-scheduled-window-screenshot.yaml16# Description: Built-in automation: captures the frontmost window of one chosen application into a dated PNG, with consent.17#18# Author: Simon-Pierre Boucher19# Contact: contact@spboucher.ai20#21# Limitations22# - Needs the macOS Screen Recording permission for ORIX (System Settings › Privacy & Security). ORIX cannot grant it23#   to itself; without it the capture step ends BLOCKED_PERMISSION and no file is written.24# - Only the window of the application named by `bundleID` is captured (permission scope window:<bundleID>), never the25#   whole display. A window showing passwords or payment forms is still captured as displayed: choose the app with care.26#   Password managers are refused by the tool, and nothing is captured while a password field has keyboard focus.27# - When the app has no normal window on screen (not running, minimised, on another Space) the capture is skipped, the28#   run succeeds and says `captured: false`; nothing is launched or brought forward.29# - Screenshots stay in the local folder; no step sends them anywhere. Old captures are never pruned.30# - A locked or sleeping Mac yields no usable window capture.31apiVersion: orix.ai/v132kind: Automation33metadata:34  id: scheduled-window-screenshot35  name: Scheduled screenshot of a selected app window36  description: >-37    On weekdays, every hour, captures the frontmost window of one chosen application into a dated PNG,38    provided the user granted Screen Recording and accepted the window-scoped permission of this workflow.39  tags: [screen, screenshot, schedule, consent]40spec:41  triggers:42    - type: schedule43      cron: "0 9-17 * * MON-FRI"44      timezone: America/Toronto45    - type: manual46  parameters:47    - name: bundleID48      type: string49      default: com.apple.Safari50      description: Bundle identifier of the application whose window is captured.51    - name: outputFolder52      type: path53      default: ~/ORIX Samples/scheduled-window-screenshot/Captures54      description: Folder that receives the screenshots.55  permissions:56    filesystem:57      read: ["${{ params.outputFolder }}"]58      write: ["${{ params.outputFolder }}"]59    screen: ["window:${{ params.bundleID }}"]60  budget:61    maxDurationSeconds: 12062    maxToolCalls: 1063  steps:64    - id: paths65      set:66        capture: ${{ params.outputFolder }}/capture-${{ env.DATE }}-${{ env.TIMESTAMP }}.png67    - id: prepare68      tool: filesystem.mkdir69      with:70        path: ${{ params.outputFolder }}71    - id: windows72      name: Is a window of the app on screen?73      tool: system.windows74      with:75        bundleID: ${{ params.bundleID }}76    - id: hasWindow77      needs: [windows, paths, prepare]78      if: ${{ len(steps.windows.output.windows) > 0 }}79      then: [capture, check]80    - id: capture81      name: Capture the window82      tool: screen.capture83      with:84        scope: window85        bundleID: ${{ params.bundleID }}86        path: ${{ vars.capture }}87      timeoutSeconds: 3088    - id: check89      needs: [capture]90      verify:91        - fileNonEmpty: ${{ vars.capture }}92        - truthy: ${{ steps.capture.output.pixelWidth > 0 && steps.capture.output.pixelHeight > 0 }}93    - id: result94      needs: [hasWindow]95      output:96        captured: ${{ steps.hasWindow.output.result }}97        file: ${{ vars.capture }}98        application: ${{ params.bundleID }}99        windows: ${{ len(steps.windows.output.windows) }}100
Files main
Menu

Theme