AppleScript Runtime
Runtimes & APIsAppleScript Runtime

AppleScript Runtime

Out-of-process AppleScript execution, parameter injection, and 30s watchdog.

Subprocess Execution Model

OpenClip executes AppleScripts out-of-process via /usr/bin/osascript rather than in-process NSAppleScript. This prevents slow or hanging Apple Events from blocking the Swift thread pool and ensures the 30-second watchdog can terminate frozen processes.

Variable Injection & Escaping

The selected text is injected at the top of your script as an escaped property declaration:

Injected Property Header
property OPENCLIP_TEXT : "Selected text here..."

AppleScript Example

create-note.applescript
tell application "Notes"
    activate
    tell account "iCloud"
        make new note at folder "Notes" with data OPENCLIP_TEXT
    end tell
end tell