Class App
Clipboard
get Clipboard
Get current contents of the system clipboard.
Parameters
OptionalclipboardType: clipboardTypeOptionally specify a data type to fetch from the clipboard. Default: "string"
Returns string
html To Clipboard
Takes HTML string and converts it to rich-text and places it in the system clipboard. Returns true if successful, false if an error occurred in conversion.
Parameters
- html: string
a possibly-valid html string
Returns boolean
- html: string
set Clipboard
Set the contents of the system clipboard.
Parameters
- contents: string | object
the data to set in the clipboard. If a
stringis passed it is set in the clipboard. Optionally an object with clipboardType keys and string values can be passed to set multiple data types in the clipboard.
Returns void
- contents: string | object
Deprecated
current Workspace
Readonlyis Action List Visible
Readonlyis Draft List Visible
apply Workspace
hide Action List
hide Draft List
load Action Bar Group
load Action Group
load Keyboard Action Group
show Action List
show Draft Info
show Draft List
show Quick Search
Interface
current Window
Returns a window object configured representing the active window.
open In New Window
If able, open the requested draft in a new window. This method only functions on iPad and Mac. The ability to open new windows is not available on iPhone.
Parameters
- draft: Draft
Returns boolean
trueif successful.falseif unable to open a new window (as on iPhone).
select Draft
Open draft selection interface and wait for user to select a draft. Returns the select draft object, or
undefinedif user cancelled.Parameters
Optionalworkspace: WorkspaceIf provided, the workspace will define the default filtering, display, and sort options for the selection window.
Returns Draft | undefined
Live Activities
Readonlyare Live Activities Supported
Check if Live Activities are supported on the current device/platform.
start Live Activity
Start a Live Activity for the selected Draft. Returns true if Live Activity started successfully. Returns false if Live Activity could not be started, or Live Activities are not supported on the device.
Parameters
- draft: Draft
The draft to use in the Live Activity
Returns boolean
- draft: Draft
stop Live Activity
Stop a Live Activity for the selected Draft. Returns true if Live Activity stopped successfully.
Parameters
- draft: Draft
The draft to use in the Live Activity
Returns boolean
- draft: Draft
Messages
display Error Message
Show error banner notification with the message passed.
Parameters
- message: string
Returns void
display Info Message
Show info banner notification with the message passed.
Parameters
- message: string
Returns void
display Success Message
Show success banner notification with the message passed.
Parameters
- message: string
Returns void
display Warning Message
Show warning banner notification with the message passed.
Parameters
- message: string
Returns void
System
is Idle Disabled
Is system sleep timer disabled preventing screen dimming/sleep.
Readonlyis Pro
Returns true if app has an active Drafts Pro subscription.
Readonlyversion
Version number of current installation of Drafts.
Theme
Readonlycurrent Theme Mode
Returns the active theme mode, light or dark, taking into account automatic switching of themes if active. If writing scripts to branch logic based on the current mode, this is the best property to use.
dark Theme
The current dark mode theme.
light Theme
The current light mode theme.
theme Mode
Get or set themeMode.
Utility
lookup
Parameters
- term: string
term to open
Returns boolean
- term: string
open URL
Request system opens the URL passed. Returns true if URL was opened, false if the URL was invalid or no available app can open the URL on the device.
Parameters
- url: string
url to open
OptionaluseSafari: booleanwhether to use the Safari View Controller (true) or default browser (false).
Returns boolean
- url: string
queue Action
Queues an action to run on a draft after the current action is complete.
// lookup action and draft, and queue the action to run
let a = Action.find("Copy");
let d = Draft.find("UUID");
app.queueAction(a, d);Parameters
Returns boolean
set Idle Disabled
Enable and disable the iOS system sleep timer to prevent screen dimming/sleep.
Parameters
- isDisabled: boolean
Returns void

Drafts defines a single global
appobject which provides access to application level functions.Example
Toggle light-dark mode