Posted Wednesday, April 22, 2026 by Sri. Tagged MEMO

Drafts Script Reference

Organized by Architectural Concern by Claude Sonnet 4.6

PROBABLY INCORRECT


Core Runtime

State Singletons

  • V app — Global instance of the running App (Content & Org, Automation, Editor)
  • V draft — The currently active Draft (all concerns)
  • V editor — The current Editor state (Editor, Text Processing)
  • V context — Execution context for the running Action (Automation)
  • V action — The currently executing Action (Automation, Content & Org)
  • V device — Hardware and OS information (Automation, Editor)

Classes

  • C App — Top-level application controller; settings, navigation, global ops (Content & Org, Editor)
  • C Draft — Primary content object; text, metadata, tags, timestamps (all concerns)
  • C Editor — Interface to the text editing surface for the active draft (Editor, Text Processing)
  • C Context — Runtime info about the action execution environment (Automation)
  • C Action — Represents a Drafts action available for execution (Automation, Content & Org)
  • C Device — Exposes device model, OS version, platform identifiers (Automation)
  • C Script — Introspection handle for the currently running script (Automation)
  • C Version — Represents a historical version of a draft (Core Runtime only)

Types

  • T draftFolder — Enum of inbox/archive/trash folder locations (Content & Org)
  • T draftFolderTab — Enum of UI tab states for folder views (Content & Org)
  • T flagStatus — Enum for draft flagged/unflagged state (Content & Org)
  • T sortBy — Enum of available draft sort criteria (Content & Org)
  • T textRange — Start and length pair for text selection or manipulation (Editor)
  • T navigationMarker — Structural navigation point within a draft (Editor)
  • T linkedItem — Reference to an object linked to a draft (Content & Org, Calendars)

Content & Organization

  • C ActionGroup — A named collection of Actions for organizational grouping
  • C Tag — A label applied to drafts for filtering and organization
  • C Workspace — A saved filter and sort configuration for the draft list
  • C Syntax — A syntax definition controlling highlighting and behavior
  • C Theme — A visual theme applied to the editor interface
  • T syntaxType — Enum of available built-in syntax identifiers
  • T themeType — Enum of light/dark theme variants
  • T tintColor — Enum of available UI accent colors
  • T capitalizationTypes — Enum of keyboard auto-capitalization modes
  • T keyboardTypes — Enum of keyboard input type variants

Automation & Actions

  • C ActionLog — Record of action execution history and results
  • C Shortcut — Interface to Apple Shortcuts for triggering or passing data
  • C CallbackURL — Constructs and dispatches x-callback-url calls to other apps
  • C URL — Opens URLs in the system browser or registered handlers
  • C AppleScript — Executes AppleScript on macOS
  • C ShellScript — Executes shell commands on macOS
  • F alert() — Displays a blocking modal alert dialog
  • F require() — Loads an external script library into the current context
  • F adjustDate() — Computes a new date by applying an offset expression
  • F strftime() — Formats a date object using strftime-style format strings

Editor & Input

  • C Prompt — Builds and displays a modal input form with configurable fields
  • C Autocomplete — Provides autocomplete suggestions within the editor
  • C QueryDate — UI control for natural language date input and parsing
  • C Speech — Triggers text-to-speech output
  • C SpeechVoice — Represents an available system voice for speech synthesis
  • C HTMLPreview — Renders an HTML string in a modal preview panel
  • T queryDateField — Enum of date fields targetable in date queries
  • T queryDateType — Enum of relative date range types for queries
  • T clipboardType — Enum of clipboard content type variants

Text Processing & Transformation

  • C HTML — Converts draft Markdown content to HTML
  • C HTMLToMarkdown — Converts HTML strings back to Markdown
  • C GitHubMarkdown — Renders Markdown using GitHub-flavored parsing rules
  • C MultiMarkdown — Processes text using MultiMarkdown extended syntax
  • C MustacheTemplate — Renders Mustache-syntax templates against a data object
  • C Base64 — Encodes and decodes Base64 strings

AI & Language Models

  • C AnthropicAI — Client for Anthropic Claude API completions
  • C OpenAI — Client for OpenAI API completions and operations
  • C GoogleAI — Client for Google Gemini API completions
  • C SystemLanguageModel — Interface to the on-device Apple Intelligence model
  • C SystemLanguageModelSchema — Defines structured output schema for on-device model requests

Calendars, Reminders & Tasks

  • C Calendar — Reads and writes calendars via EventKit
  • C Event — Represents a calendar event with time, title, and attendees
  • C Alarm — An alert attached to a calendar event or reminder
  • C Reminder — A task entry in the system Reminders store
  • C ReminderList — A named list container in the Reminders store
  • C Task — A generic task object used internally within Drafts actions

Third-Party Task Managers

  • C Todoist — Client for creating and querying Todoist tasks and projects
  • C GoogleTask — Client for Google Tasks API operations
  • C MicrosoftToDo — Client for Microsoft To Do task management
  • C TJSContainer — Root container for a TaskPaper/JSON structure
  • C TJSProject — A project node within a TaskPaper structure
  • C TJSHeading — A heading node within a TaskPaper structure
  • C TJSChecklistItem — A checklist entry within a TaskPaper structure
  • C TJSTodo — An individual to-do item within a TaskPaper structure
  • T googleTask — Type definition for a Google Task item
  • T googleTaskList — Type definition for a Google Task list
  • T microsoftToDoTask — Type definition for a Microsoft To Do task
  • T microsoftToDoTaskList — Type definition for a Microsoft To Do task list
  • T microsoftToDoLinkedResource — Type definition for a resource linked to a To Do task

Messaging & Social

  • C Mail — Composes and sends email via the system mail stack
  • C GmailMessage — Composes and sends email via the Gmail API
  • C Message — Sends SMS or iMessage via the system Messages framework
  • C OutlookMessage — Composes and sends email via the Microsoft Outlook API
  • C Mastodon — Posts and interacts with the Mastodon federated network
  • C Twitter — Posts and interacts with the Twitter/X API
  • C Medium — Publishes posts to Medium via its API
  • C WordPress — Publishes posts and pages to WordPress via XML-RPC or REST
  • C Ghost — Publishes posts to a Ghost publication via its API
  • T mailStatus — Enum of mail send result states
  • T mastodonVisibility — Enum of Mastodon post visibility levels

File & Cloud Storage

  • C FileManager — Reads and writes files in local or iCloud sandboxed storage
  • C Bookmark — A persistent, permission-retained reference to a file location
  • C Dropbox — Client for reading and writing files in Dropbox
  • C Box — Client for reading and writing files in Box cloud storage
  • C OneDrive — Client for reading and writing files in Microsoft OneDrive
  • C GoogleDrive — Client for reading and writing files in Google Drive
  • I DropboxRequestSettings — Configuration object for Dropbox API requests
  • T dropboxMode — Enum for Dropbox file conflict resolution modes

Networking & Integration

  • C HTTP — Makes arbitrary HTTP requests with configurable method and headers
  • C HTTPResponse — Represents the response from an HTTP request
  • C XMLRPC — Executes XML-RPC method calls against a remote endpoint
  • C XMLRPCResponse — Represents the response from an XML-RPC call
  • C Airtable — Client for reading and writing Airtable bases and records
  • C Notion — Client for creating and updating Notion pages and databases
  • C Share — Invokes the system share sheet for a draft or content string

System & Credentials

  • C Credential — Stores and retrieves named username/password pairs from the keychain
  • C Window — Represents an application window; supports multi-window navigation on iPadOS/macOS