### static start(locale: string) Source: https://docs.scriptable.app/dictation Starts the dictation interface and returns the dictated text once the user finishes. ```APIDOC ## static start(locale: string) ### Description Presents an interface that lets you dictate text. The interface must be manually stopped by the user pressing "Done". ### Parameters #### Path Parameters - **locale** (string) - Optional - String identifier for the language (e.g., "en", "it", "da"). Defaults to the device locale. ### Response #### Success Response - **Promise** - A promise that resolves with the dictated text string. ``` -------------------------------- ### Example: Importing and Using a Module Source: https://docs.scriptable.app/importmodule This example demonstrates how to import a module named 'circle' and use its exported 'area' function. Ensure the 'circle.js' file exists in one of the accessible module directories. ```javascript let circle = importModule('circle') let r = 2 let area = circle.area(r) log('Area of circle: ' + area) ``` -------------------------------- ### Start Parsing Source: https://docs.scriptable.app/xmlparser Initiates the parsing process. Ensure all callback functions are configured before calling. ```javascript parse(): bool ``` -------------------------------- ### parse() Source: https://docs.scriptable.app/xmlparser Starts the parsing process for the configured XML string. ```APIDOC ## parse() ### Description Starts parsing the XML document. Ensure all callback functions are configured before calling this method. ### Response - **return** (bool) - Returns true if parsing was successfully started. ``` -------------------------------- ### Get Device Model Source: https://docs.scriptable.app/device Retrieves the model of the device, for example, "iPhone". ```javascript static model(): string ``` -------------------------------- ### GET /all Source: https://docs.scriptable.app/contactscontainer Fetches all available contacts containers on the device. ```APIDOC ## static all() ### Description Fetches all contacts containers. ### Return Value - **Promise<[ContactsContainer]>** - Promise that provides all contacts containers when fulfilled. ``` -------------------------------- ### didStartElement Callback Source: https://docs.scriptable.app/xmlparser Invoked upon encountering a start tag. Provides the element name and a dictionary of attributes. ```javascript didStartElement: fn(string, {string: string}) ``` -------------------------------- ### Start Dictation Interface Source: https://docs.scriptable.app/dictation Initiates the dictation interface. The optional locale parameter specifies the language for recognition. ```javascript static start(locale: string): Promise ``` -------------------------------- ### Get Operating System Version Source: https://docs.scriptable.app/device Retrieves the version of the operating system. ```javascript static systemVersion(): string ``` -------------------------------- ### Get Operating System Name Source: https://docs.scriptable.app/device Retrieves the name of the operating system. ```javascript static systemName(): string ``` -------------------------------- ### GET allFileBookmarks Source: https://docs.scriptable.app/filemanager Retrieves a list of all file bookmarks configured in the Scriptable settings. ```APIDOC ## GET allFileBookmarks ### Description Reads all file bookmarks created in the Scriptable settings. File bookmarks allow scripts to bookmark files or folders for later read/write access. ### Method GET ### Endpoint allFileBookmarks() ### Response #### Success Response (200) - **Array of Objects** - An array containing objects with the following structure: - **name** (string) - The name of the bookmark. - **source** (string) - The source of the bookmark, either 'host' (for app usage) or 'siri_shortcuts' (for Siri and Shortcuts usage). #### Response Example [ { "name": "My Bookmark", "source": "host" } ] ``` -------------------------------- ### Retrieve Text Field Value Source: https://docs.scriptable.app/alert Gets the entered value from a text field at a specific index. Indices start at 0. ```javascript textFieldValue(index: number): string ``` -------------------------------- ### Get Callback URL Source: https://docs.scriptable.app/callbackurl Generates the full URL string including the base URL and all added query parameters. ```javascript getURL(): string ``` -------------------------------- ### Get UUID as String Source: https://docs.scriptable.app/uuid Use this method to retrieve the string representation of a UUID. No specific setup is required beyond having a UUID object. ```javascript static string(): string ``` -------------------------------- ### QuickLook.present Source: https://docs.scriptable.app/quicklook Presents an item using the best-suited method. Can be displayed in fullscreen when used within the app. ```APIDOC ## POST /websites/scriptable_app/QuickLook/present ### Description Presents the item using the best-suited method. Can be displayed in fullscreen when used within the app. ### Method POST ### Endpoint /websites/scriptable_app/QuickLook/present ### Parameters #### Request Body - **item** (any) - Required - The item to be presented. - **fullscreen** (boolean) - Optional - Set to true to present the item in fullscreen. Defaults to false. ### Response #### Success Response (200) - **Promise** - A promise that is fulfilled when the quick look is dismissed. ### Request Example { "item": "path/to/your/file.jpg", "fullscreen": true } ### Response Example { "status": "fulfilled" } ``` -------------------------------- ### Method: presentSmall Source: https://docs.scriptable.app/listwidget Presents a preview of the widget in small size. ```APIDOC ## presentSmall() ### Description The widget is presented in its small size for previewing within the app. ### Response #### Success Response (200) - **Promise** (object) - Promise that is fulfilled when the preview is dismissed. ``` -------------------------------- ### Define gradient start point Source: https://docs.scriptable.app/lineargradient Sets the normalized starting point of the gradient with X and Y components ranging from 0 to 1. ```javascript startPoint: Point ``` -------------------------------- ### Present an item with QuickLook Source: https://docs.scriptable.app/quicklook Defines the static method signature for presenting items, including an optional fullscreen parameter. ```typescript static present(item: any, fullscreen: bool): Promise ``` -------------------------------- ### Get URL for opening script settings Source: https://docs.scriptable.app/urlscheme Generates the URL to open the settings of the current script from another application. When requested, the script's settings will be opened in Scriptable. ```javascript static forOpeningScriptSettings(): string ``` -------------------------------- ### WebView Initialization Source: https://docs.scriptable.app/webview Constructs a new web view. Use a web view to evaluate JavaScript on websites. ```APIDOC ## new WebView ### Description Constructs a new web view. Use a web view to evaluate JavaScript on websites. ### Method `new` ### Endpoint N/A ### Request Example ``` new WebView() ``` ``` -------------------------------- ### Construct a new WebView Source: https://docs.scriptable.app/webview Initializes a new instance of the WebView class. ```javascript new WebView() ``` -------------------------------- ### Get HTML Content from Web View Source: https://docs.scriptable.app/webview Reads and returns the HTML content of the currently loaded website in the web view. ```swift getHTML(): Promise ``` -------------------------------- ### File Name Operations Source: https://docs.scriptable.app/filemanager Functions to get the name and extension of files. ```APIDOC ## GET /websites/scriptable_app/fileName ### Description Get the name of a file, optionally including its extension. ### Method GET ### Endpoint /websites/scriptable_app/fileName ### Parameters #### Query Parameters - **filePath** (string) - Required - Path of the file to get the name of. - **includeFileExtension** (boolean) - Optional - Whether to include the file extension. Defaults to false. ### Response #### Success Response (200) - **fileName** (string) - The name of the file. ### Response Example ```json { "fileName": "example.txt" } ``` ## GET /websites/scriptable_app/fileExtension ### Description Get the extension of a file. ### Method GET ### Endpoint /websites/scriptable_app/fileExtension ### Parameters #### Query Parameters - **filePath** (string) - Required - Path of the file to get the extension from. ### Response #### Success Response (200) - **fileExtension** (string) - The extension of the file (e.g., ".jpg", ".js"). Returns an empty string for directories. ### Response Example ```json { "fileExtension": ".txt" } ``` ``` -------------------------------- ### Constructor: new CallbackURL Source: https://docs.scriptable.app/callbackurl Initializes a new CallbackURL instance with a base URL. ```APIDOC ## new CallbackURL(baseURL) ### Description Constructs an object that opens x-callback-url requests and waits for a response from the target app. ### Parameters #### Path Parameters - **baseURL** (string) - Required - Base URL of the request (e.g., my-app://x-callback-url/action) ``` -------------------------------- ### Get Preferred Font for Footnotes Source: https://docs.scriptable.app/font Returns the preferred font for footnotes. ```javascript static footnote(): Font ``` -------------------------------- ### present Source: https://docs.scriptable.app/webview Presents the web view to the user, optionally in fullscreen mode. ```APIDOC ## present ### Description Presents the web view. ### Method POST ### Endpoint /websites/scriptable_app/present ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **fullscreen** (boolean) - Optional - Set to true to present the web view in fullscreen. Defaults to false. ### Request Example ```json { "fullscreen": true } ``` ### Response #### Success Response (200) - **Promise** (Promise) - Promise that is fulfilled when the presented web view is dismissed. The promise carries no value. #### Response Example ```json { "status": "dismissed" } ``` ``` -------------------------------- ### Method: open Source: https://docs.scriptable.app/callbackurl Opens the callback URL and waits for a response. ```APIDOC ## open() ### Description Opens the target app and waits for the target app to perform the action. The promise is rejected if the action fails, is cancelled, or times out. ### Response #### Success Response - **Promise<{string: string}>** - A promise that provides the query parameters supplied by the target app when it invokes the callback. ``` -------------------------------- ### Get Preferred Font for Subheadings Source: https://docs.scriptable.app/font Returns the preferred font for subheadings. ```javascript static subheadline(): Font ``` -------------------------------- ### Open website in-app Source: https://docs.scriptable.app/safari Presents a website within the current app. The fullscreen parameter is optional and defaults to true. ```typescript static openInApp(url: string, fullscreen: bool): Promise ``` -------------------------------- ### Get Device Language Source: https://docs.scriptable.app/device Retrieves the identifier for the device's language. ```javascript static language(): string ``` -------------------------------- ### Get Device Locale Source: https://docs.scriptable.app/device Retrieves the identifier for the device's locale. ```javascript static locale(): string ``` -------------------------------- ### Constructor: new ListWidget() Source: https://docs.scriptable.app/listwidget Constructs a new instance of a list widget. ```APIDOC ## new ListWidget() ### Description Constructs a new list widget to be displayed on the Home Screen. ### Method Constructor ### Endpoint new ListWidget() ``` -------------------------------- ### Open an existing script via URL scheme Source: https://docs.scriptable.app/urlscheme Use this URL scheme to open an existing script. The script name must be URL encoded. Optionally, include `openSettings=true` to open script settings. ```url scriptable:///open/Example ``` -------------------------------- ### GET /withIdentifier Source: https://docs.scriptable.app/contactscontainer Fetches a specific contacts container by its unique identifier. ```APIDOC ## static withIdentifier(identifier) ### Description Fetches a contacts container by its identifier. ### Parameters - **identifier** (string) - Required - Identifier of the contacts container to fetch. ### Return Value - **Promise** - Promise that provides the contacts container when fulfilled. ``` -------------------------------- ### GET /default Source: https://docs.scriptable.app/contactscontainer Fetches the default contacts container available on the device. ```APIDOC ## static default() ### Description Fetches the default contacts container. ### Return Value - **Promise** - Promise that provides the default contacts container when fulfilled. ``` -------------------------------- ### Construct a new Path Source: https://docs.scriptable.app/path Initializes a new instance of the Path class. ```javascript new Path() ``` -------------------------------- ### Safari.open Source: https://docs.scriptable.app/safari Presents a website by opening the default external browser (Safari). ```APIDOC ## POST /websites/scriptable_app/safari/open ### Description Presents a website in the Safari app, thus leaving the current app. ### Method POST ### Endpoint /websites/scriptable_app/safari/open ### Parameters #### Query Parameters - **url** (string) - Required - URL of the website to present. ### Request Example { "url": "https://example.com" } ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. #### Response Example { "success": true } ``` -------------------------------- ### Draw text at position Source: https://docs.scriptable.app/drawcontext Draws a text string starting at the specified point. ```javascript drawText(text: string, pos: Point) ``` -------------------------------- ### Configure imageSize property Source: https://docs.scriptable.app/widgetimage Sets the display size of the image. Set to null for full size. ```text imageSize: Size ``` -------------------------------- ### Define Request Method Source: https://docs.scriptable.app/request Sets the HTTP method for the request, defaulting to GET. ```javascript method: string ``` -------------------------------- ### Construct Notification Source: https://docs.scriptable.app/notification Creates a new instance of a notification. ```text new Notification() ``` -------------------------------- ### Module System Overview Source: https://docs.scriptable.app/module Explains the core concepts of the Scriptable module system, including importing modules and defining exported functions or objects. ```APIDOC ## Module System ### Description Scriptable treats each file as a module. Modules can export functions or objects to be used in other scripts via the `importModule` function. ### Usage - **Importing**: `let module = importModule('filename')` - **Exporting**: Assign values to `module.exports` to make them available to importers. ### Properties - **filename** (string) - Read-only. The absolute path to the file containing the module. - **exports** (any) - The object or value returned by `importModule`. Defaults to an empty object. ``` -------------------------------- ### Get Preferred Font for Headings Source: https://docs.scriptable.app/font Returns the preferred font for general headings. ```javascript static headline(): Font ``` -------------------------------- ### Get Bytes from Data Source: https://docs.scriptable.app/data Retrieves the underlying byte array from the Data object. ```typescript getBytes(): [number] ``` -------------------------------- ### Data Creation Methods Source: https://docs.scriptable.app/data Static methods to initialize a Data object from different input formats. ```APIDOC ## static fromString(string) ### Description Creates data from a UTF8 encoded string. ### Parameters #### Path Parameters - **string** (string) - Required - String to create data from. ### Response - **Data** - Data representation of the string. ## static fromFile(filePath) ### Description Reads the raw data of the file at the specified file path. ### Parameters #### Path Parameters - **filePath** (string) - Required - Path of file to read data from. ### Response - **Data** - Data representation of the file. ## static fromBase64String(base64String) ### Description Creates data from a base64 encoded string. ### Parameters #### Path Parameters - **base64String** (string) - Required - Base64 encoded string to create data from. ### Response - **Data** - Data representation of the string. ## static fromJPEG(image) ### Description Creates data from a JPEG image. ### Parameters #### Path Parameters - **image** (Image) - Required - JPEG image to convert to data. ### Response - **Data** - Data representation of the image. ## static fromPNG(image) ### Description Creates data from a PNG image. ### Parameters #### Path Parameters - **image** (Image) - Required - PNG image to convert to data. ### Response - **Data** - Data representation of the image. ## static fromBytes(bytes) ### Description Creates data from an array of bytes. ### Parameters #### Path Parameters - **bytes** ([number]) - Required - Array of bytes to convert to data. ### Response - **Data** - Data created from the bytes. ``` -------------------------------- ### Get Default Calendars Source: https://docs.scriptable.app/calendar Retrieve the system default calendar for reminders or events. ```javascript static defaultForReminders(): Promise ``` ```javascript static defaultForEvents(): Promise ``` -------------------------------- ### Static Color Creation Methods Source: https://docs.scriptable.app/color Static methods to construct predefined Color objects. ```APIDOC ## Static Color Creation Methods ### +black Constructs a black color. ``` static black(): Color ``` ### +darkGray Constructs a dark gray color. ``` static darkGray(): Color ``` ### +lightGray Constructs a light gray color. ``` static lightGray(): Color ``` ### +white Constructs a white color. ``` static white(): Color ``` ### +gray Constructs a gray color. ``` static gray(): Color ``` ### +red Constructs a red color. ``` static red(): Color ``` ### +green Constructs a green color. ``` static green(): Color ``` ### +blue Constructs a blue color. ``` static blue(): Color ``` ### +cyan Constructs a cyan color. ``` static cyan(): Color ``` ### +yellow Constructs a yellow color. ``` static yellow(): Color ``` ### +magenta Constructs a magenta color. ``` static magenta(): Color ``` ### +orange Constructs an orange color. ``` static orange(): Color ``` ### +purple Constructs a purple color. ``` static purple(): Color ``` ### +brown Constructs a brown color. ``` static brown(): Color ``` ### +clear Constructs a transparent color. ``` static clear(): Color ``` ``` -------------------------------- ### Get Device Volume Source: https://docs.scriptable.app/device Retrieves the current volume of the device, ranging from 0 to 1. ```javascript static volume(): number ``` -------------------------------- ### Construct New Request Source: https://docs.scriptable.app/request Initializes a new request instance for a specific URL. ```javascript new Request(url: string) ``` -------------------------------- ### Get Battery Level Source: https://docs.scriptable.app/device Retrieves the current battery level as a percentage (0 to 1). ```javascript static batteryLevel(): number ``` -------------------------------- ### Load a URL statically Source: https://docs.scriptable.app/webview Loads and presents a URL in a new web view instance. ```javascript static loadURL(url: string, preferredSize: Size, fullscreen: bool): Promise ``` -------------------------------- ### Get Screen Brightness Source: https://docs.scriptable.app/device Retrieves the current brightness of the screen as a percentage (0 to 1). ```javascript static screenBrightness(): number ``` -------------------------------- ### Present the Table Source: https://docs.scriptable.app/uitable Displays the table. Optionally present it in fullscreen mode, which is effective only when used within the app. Returns a Promise that resolves when the table is dismissed. ```javascript present(fullscreen: bool): Promise ``` -------------------------------- ### DrawContext Initialization and Properties Source: https://docs.scriptable.app/drawcontext This section covers the initialization of a DrawContext and its core properties like size, respectScreenScale, and opaque. ```APIDOC ## DrawContext Context for drawing images. An instance of DrawContext is a canvas on which you can draw an image using shapes, texts and other images. You must specify the size of your canvas by setting the size property. At any point after beginning your drawing and before ending your drawing can you call getImage() to get an image object of your drawing. ### Properties * **size** (Size) - The size of the canvas. The image returned by getImage() will have this exact size, except if respectScreenScale is true. * **respectScreenScale** (bool) - Enable to respect the scale of the screen. Default is false. * **opaque** (bool) - Determines whether the context is opaque. Default is true. ### Constructor * **new DrawContext()** - Constructs a new canvas to draw images, shapes and texts on. ``` -------------------------------- ### Close subpath Source: https://docs.scriptable.app/path Draws a straight line from the current position back to the start of the current subpath. ```javascript closeSubpath() ``` -------------------------------- ### UITable Presentation and Configuration Source: https://docs.scriptable.app/uitable Methods for configuring table appearance and presenting the table view. ```APIDOC ## showSeparators ### Description Whether to show separators between rows. Defaults to false. ## reload() ### Description Reloads the table to reflect changes made to rows while the table is presented. ## present(fullscreen) ### Description Presents the table view. ### Parameters #### Query Parameters - **fullscreen** (bool) - Optional - Set to true to present in fullscreen. Defaults to false. ### Response - **Promise** - Fulfilled when the table is dismissed. ``` -------------------------------- ### Add a rectangle Source: https://docs.scriptable.app/path Adds a rectangle to the path, drawn counter-clockwise starting from the lower left corner. ```javascript addRect(rect: Rect) ``` -------------------------------- ### Run a script using Universal Link Source: https://docs.scriptable.app/urlscheme Perform actions like running a script using a universal link. This is an alternative to the `scriptable://` scheme. ```url https://open.scriptable.app/run/Example ``` -------------------------------- ### Get Preferred Font for Caption Level 2 Source: https://docs.scriptable.app/font Returns the preferred font for alternate captions. ```javascript static caption2(): Font ``` -------------------------------- ### Get Preferred Font for Caption Level 1 Source: https://docs.scriptable.app/font Returns the preferred font for standard captions. ```javascript static caption1(): Font ``` -------------------------------- ### Preview ListWidget Source: https://docs.scriptable.app/listwidget Methods to display a preview of the widget within the app. ```javascript presentSmall(): Promise ``` ```javascript presentMedium(): Promise ``` -------------------------------- ### Get Preferred Languages Source: https://docs.scriptable.app/device Retrieves a list of the user's preferred languages, ordered by preference. ```javascript static preferredLanguages(): [string] ``` -------------------------------- ### didStartDocument Callback Source: https://docs.scriptable.app/xmlparser Invoked when the parser begins processing a document. ```javascript didStartDocument: fn() ``` -------------------------------- ### Get Screen Resolution Source: https://docs.scriptable.app/device Retrieves the resolution of the screen in pixels. This value does not account for device rotation. ```javascript static screenResolution(): Size ``` -------------------------------- ### Open a folder with DocumentPicker Source: https://docs.scriptable.app/documentpicker Presents a picker to select a folder. ```javascript static openFolder(): Promise ``` -------------------------------- ### Weight and Font Configuration Methods Source: https://docs.scriptable.app/sfsymbol Methods to configure the appearance of the SFSymbol, including font and weight adjustments. ```APIDOC ## Configuration Methods ### Description Methods to apply specific font or weight styles to the SFSymbol instance. ### Methods - **applyFont(font: Font)** - Configures the symbol with the specified font information. - **applyUltraLightWeight()** - Configures the symbol to use an ultra light weight. - **applyThinWeight()** - Configures the symbol to use a thin weight. - **applyLightWeight()** - Configures the symbol to use a light weight. - **applyRegularWeight()** - Configures the symbol to use a regular weight. - **applyMediumWeight()** - Configures the symbol to use a medium weight. - **applySemiboldWeight()** - Configures the symbol to use a semibold weight. - **applyBoldWeight()** - Configures the symbol to use a bold weight. - **applyHeavyWeight()** - Configures the symbol to use a heavy weight. - **applyBlackWeight()** - Configures the symbol to use a black weight. ``` -------------------------------- ### Get Screen Size Source: https://docs.scriptable.app/device Retrieves the size of the screen in points. The value accounts for device rotation. ```javascript static screenSize(): Size ``` -------------------------------- ### Run an existing script via URL scheme Source: https://docs.scriptable.app/urlscheme Use this URL scheme to run an existing script. The script name must be URL encoded. Set `openEditor=true` to run with the editor shown. ```url scriptable:///run/Example ``` -------------------------------- ### Get Image Size Source: https://docs.scriptable.app/image Access the read-only 'size' property to retrieve the dimensions of an image in pixels. ```swift size: Size ``` -------------------------------- ### Safari.openInApp Source: https://docs.scriptable.app/safari Presents a website within the application using a web view. ```APIDOC ## POST /websites/scriptable_app/safari/openInApp ### Description Presents a website in-app without leaving the current application. ### Method POST ### Endpoint /websites/scriptable_app/safari/openInApp ### Parameters #### Query Parameters - **url** (string) - Required - URL of the website to present. - **fullscreen** (boolean) - Optional - Set to true to display the web view in fullscreen. Defaults to true. ### Request Example { "url": "https://example.com", "fullscreen": true } ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. #### Response Example { "success": true } ``` -------------------------------- ### Create Directory Source: https://docs.scriptable.app/filemanager Creates a new directory at the specified path. Optionally creates intermediate directories if they do not exist. ```APIDOC ## createDirectory ### Description Creates a directory at the specified path. You can optionally create all intermediate directories. ### Method N/A (Function call) ### Endpoint N/A ### Parameters #### Path Parameters - **path** (string) - Required - Path of directory to create. - **intermediateDirectories** (bool) - Optional - Whether to create all intermediate directories. Defaults to false. ``` -------------------------------- ### Get Preferred Font for Title Level 3 Source: https://docs.scriptable.app/font Returns the preferred font for third-level hierarchical headings. ```javascript static title3(): Font ``` -------------------------------- ### Initialize a New Table Source: https://docs.scriptable.app/uitable Constructs a new table object to display structured data. Use this to begin creating your table. ```javascript new UITable() ``` -------------------------------- ### Get Preferred Font for Title Level 2 Source: https://docs.scriptable.app/font Returns the preferred font for second-level hierarchical headings. ```javascript static title2(): Font ``` -------------------------------- ### Configure resizable property Source: https://docs.scriptable.app/widgetimage Determines if the image can be resized. Defaults to true. ```text resizable: bool ``` -------------------------------- ### Configure tintColor property Source: https://docs.scriptable.app/widgetimage Applies a tint color to the image. Set to null to show the original image. ```text tintColor: Color ``` -------------------------------- ### Get Preferred Font for Title Level 1 Source: https://docs.scriptable.app/font Returns the preferred font for first-level hierarchical headings. ```javascript static title1(): Font ``` -------------------------------- ### Get Device Name Source: https://docs.scriptable.app/device Retrieves the name identifying the device. This name can be found and edited in system settings. ```javascript static name(): string ``` -------------------------------- ### XMLParser Constructor Source: https://docs.scriptable.app/xmlparser Initializes a new instance of the XMLParser with the provided XML string. ```APIDOC ## new XMLParser(string) ### Description Constructs an event-driven XML parser for the specified XML string. ### Parameters - **string** (string) - Required - The XML string to be parsed. ``` -------------------------------- ### Fetch Reminders by Date Range Source: https://docs.scriptable.app/reminder Methods to retrieve reminders based on specific start and end date intervals. ```typescript static allDueBetween(startDate: Date, endDate: Date, calendars: [Calendar]): Promise<[Reminder]> ``` ```typescript static completedDueBetween(startDate: Date, endDate: Date, calendars: [Calendar]): Promise<[Reminder]> ``` ```typescript static incompleteDueBetween(startDate: Date, endDate: Date, calendars: [Calendar]): Promise<[Reminder]> ``` ```typescript static completedBetween(startDate: Date, endDate: Date, calendars: [Calendar]): Promise<[Reminder]> ``` -------------------------------- ### Create a New Alert Source: https://docs.scriptable.app/alert Initializes a new alert object. Use this to begin configuring an alert. ```javascript new Alert() ``` -------------------------------- ### Open any file with DocumentPicker Source: https://docs.scriptable.app/documentpicker Presents a picker to select any file type. ```javascript static openFile(): Promise ``` -------------------------------- ### Get Preferred Font for Callouts Source: https://docs.scriptable.app/font Returns the preferred font for callout text, often used for notes or annotations. ```javascript static callout(): Font ``` -------------------------------- ### Image.fromFile Source: https://docs.scriptable.app/image Creates an image instance by loading it from a specified file path. ```APIDOC ## static fromFile(filePath) ### Description Loads an image from the specified file path. If the image could not be read, the function will return null. ### Parameters #### Path Parameters - **filePath** (string) - Required - File path to read image from. ### Response #### Success Response - **Image** (Image) - The read image or null if the image could not be read. ``` -------------------------------- ### Get Preferred Font for Body Text Source: https://docs.scriptable.app/font Returns the preferred font for body text, suitable for main content. ```javascript static body(): Font ``` -------------------------------- ### Get Preferred Font for Large Titles Source: https://docs.scriptable.app/font Returns the preferred font for large titles, suitable for prominent headings. ```javascript static largeTitle(): Font ``` -------------------------------- ### ShareSheet.present Source: https://docs.scriptable.app/sharesheet Presents the activity picker to the user. ```APIDOC ## POST /websites/scriptable_app/ShareSheet/present ### Description Presents a share sheet with an array of items to share. The activities included in the presented sheet will vary based on the type of item. ### Method POST ### Endpoint /websites/scriptable_app/ShareSheet/present ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **activityItems** (any[]) - Required - Items to perform activity on. ### Request Example ```json { "activityItems": [ "Example Item 1", 123, { "key": "value" } ] } ``` ### Response #### Success Response (200) - **string** (any) - A value that indicates which activity was performed, if any. #### Response Example ```json { "activityPerformed": "email" } ``` ``` -------------------------------- ### Load HTML content statically Source: https://docs.scriptable.app/webview Renders HTML content in a new web view instance. ```javascript static loadHTML(html: string, baseURL: string, preferredSize: Size, fullscreen: bool): Promise ``` -------------------------------- ### Load a file statically Source: https://docs.scriptable.app/webview Renders a file, such as an HTML document or image, in a new web view instance. ```javascript static loadFile(fileURL: string, preferredSize: Size, fullscreen: bool): Promise ``` -------------------------------- ### Construct CallbackURL Source: https://docs.scriptable.app/callbackurl Initializes a new CallbackURL instance with the specified base URL. ```javascript new CallbackURL(baseURL: string) ``` -------------------------------- ### Get all URL scheme parameters Source: https://docs.scriptable.app/urlscheme Retrieves all query parameters passed in the URL when running a script. Deprecated in favor of `args.queryParameters`. ```javascript static allParameters(): {string: string} ``` -------------------------------- ### File Utility API Source: https://docs.scriptable.app/filemanager Utility functions for interacting with files and directories, including getting file types and listing directory contents. ```APIDOC ## POST /getUTI ### Description Gets the UTI (Uniform Type Identifier) of the specified file. The Uniform Type Identifier is a string that identifies the type of file. ### Method POST ### Endpoint /getUTI ### Parameters #### Path Parameters - **filePath** (string) - Required - Path of file to get UTI of. ### Request Example ```json { "filePath": "/path/to/your/document.pdf" } ``` ### Response #### Success Response (200) - **uti** (string) - The UTI of the file. #### Response Example ```json { "uti": "com.adobe.pdf" } ``` ## POST /listContents ### Description Lists the content of a directory. Lists all the contents in the specified directory. The returned array contains filenames to all files and directories in the specified directory. ### Method POST ### Endpoint /listContents ### Parameters #### Path Parameters - **directoryPath** (string) - Required - Path to directory. ### Request Example ```json { "directoryPath": "/path/to/your/directory" } ``` ### Response #### Success Response (200) - **contents** (array of strings) - Names of all the files and directories in the specified directory. #### Response Example ```json { "contents": ["file1.txt", "subdirectory", "image.png"] } ``` ``` -------------------------------- ### Point Constructor Source: https://docs.scriptable.app/point Initializes a new instance of the Point structure with specified x and y coordinates. ```APIDOC ## Constructor Point ### Description Constructs a new point in a two-dimensional coordinate system. ### Parameters - **x** (number) - Required - X value. - **y** (number) - Required - Y value. ### Request Example new Point(10, 20); ``` -------------------------------- ### Static Calendar Fetching and Creation Source: https://docs.scriptable.app/calendar Static methods for retrieving, creating, or finding calendars for reminders and events. ```APIDOC ## forReminders() ### Description Fetches all calendars that can hold reminders. ## forEvents() ### Description Fetches all calendars that can hold events. ## forRemindersByTitle(title) ### Description Fetches a specific calendar for reminders by its title. ## forEventsByTitle(title) ### Description Fetches a specific calendar for events by its title. ## createForReminders(title) ### Description Creates a new calendar for reminders. ## findOrCreateForReminders(title) ### Description Finds a calendar for reminders by title, or creates one if it does not exist. ## defaultForReminders() ### Description Gets the default calendar for reminders. ## defaultForEvents() ### Description Gets the default calendar for events. ## presentPicker(allowMultiple) ### Description Presents a UI for the user to pick one or more calendars. ``` -------------------------------- ### Get Latest Screenshot from Library Source: https://docs.scriptable.app/photos Retrieves the most recent screenshot from the user's photo library. The promise will be rejected if no screenshots are available. ```javascript static latestScreenshot(): Promise ``` -------------------------------- ### Get Latest Photo from Library Source: https://docs.scriptable.app/photos Retrieves the most recent photo from the user's photo library. The promise will be rejected if no photos are available. ```javascript static latestPhoto(): Promise ``` -------------------------------- ### Set Screen Brightness Source: https://docs.scriptable.app/device Sets the brightness of the screen to a specified percentage (0 to 1). Use `screenBrightness()` to get the current value. ```javascript static setScreenBrightness(percentage: number) ``` -------------------------------- ### Present Large Widget Preview Source: https://docs.scriptable.app/listwidget Presents a preview of the widget in its large size. This is useful for testing widget appearance on the Home Screen. ```APIDOC ## presentLarge ### Description Presents a preview of the widget in its large size. Widgets on the Home Screen are updated periodically, so this function is useful for previewing your widget while developing. ### Method ```javascript presentLarge(): Promise ``` ### Endpoint N/A (This is a method within the Scriptable app) ### Return Value - **Promise** - A Promise that is fulfilled when the preview is dismissed. ``` -------------------------------- ### Timer Construction Source: https://docs.scriptable.app/timer Methods for creating and initializing Timer objects. ```APIDOC ## -new Timer Constructs a timer. ``` new Timer() ``` Constructs a timer that fires after a specified time interval. ``` -------------------------------- ### Get Screen Scale Source: https://docs.scriptable.app/device Retrieves the scale factor of the screen. Standard displays have a scale of 1.0, while Retina displays have 2.0 or 3.0. ```javascript static screenScale(): number ``` -------------------------------- ### Get URL for opening the current script Source: https://docs.scriptable.app/urlscheme Generates the URL to open the current script from another application. When requested, the script will be opened in Scriptable. ```javascript static forOpeningScript(): string ``` -------------------------------- ### Configure imageOpacity property Source: https://docs.scriptable.app/widgetimage Sets the image opacity, ranging from 0 to 1. ```text imageOpacity: number ``` -------------------------------- ### Get a specific URL scheme parameter Source: https://docs.scriptable.app/urlscheme Retrieves the value of a specific query parameter passed in the URL when running a script. Deprecated in favor of `args.queryParameters`. ```javascript static parameter(name: string): string ``` -------------------------------- ### Construct XMLParser Source: https://docs.scriptable.app/xmlparser Initializes a new XMLParser instance with the provided XML string. ```javascript new XMLParser(string: string) ``` -------------------------------- ### Get Latest Screenshots from Library Source: https://docs.scriptable.app/photos Retrieves a specified number of the most recent screenshots from the user's photo library. The promise will be rejected if no screenshots are available. ```javascript static latestScreenshots(count: number): Promise<[Image]> ``` -------------------------------- ### static speak(text: string) Source: https://docs.scriptable.app/speech Speaks the provided text string. If the script is triggered by a Siri Shortcut, the system will use Siri's voice. ```APIDOC ## static speak(text: string) ### Description Speaks a text. If used in a script triggered by a Siri Shortcut, Siri will speak the text. ### Parameters #### Request Body - **text** (string) - Required - Text to speak. ### Request Example Speech.speak("Hello world") ``` -------------------------------- ### Get Latest Photos from Library Source: https://docs.scriptable.app/photos Retrieves a specified number of the most recent photos from the user's photo library. The promise will be rejected if no photos are available. ```javascript static latestPhotos(count: number): Promise<[Image]> ``` -------------------------------- ### Import Module by Name Source: https://docs.scriptable.app/importmodule Use this function to import modules by their file name. The file extension is optional. Scriptable searches for modules in a specific order of directories. ```javascript importModule(name: string) ``` -------------------------------- ### Load Request as String Source: https://docs.scriptable.app/request Sends the request and returns a promise resolving to the response string. ```javascript loadString(): Promise ``` -------------------------------- ### Module Exports: Area and Circumference Functions Source: https://docs.scriptable.app/importmodule This is an example of a module file that exports two functions: 'area' and 'circumference'. These functions can be imported and used by other scripts using the importModule function. ```javascript module.exports.area = (r) => { return Math.PI * Math.pow(r, 2) } module.exports.circumference = (r) => { return 2 * Math.PI * r } ``` -------------------------------- ### Path Construction and Methods Source: https://docs.scriptable.app/path Methods for defining shapes within a Path instance. ```APIDOC ## new Path() ### Description Constructs a new path object. ## move(point: Point) ### Description Moves the current point to the specified location without drawing a line. ### Parameters - **point** (Point) - Required - Point to move to. ## addLine(point: Point) ### Description Adds a straight line from the current point to the specified point. ### Parameters - **point** (Point) - Required - Point to add line to. ## addRect(rect: Rect) ### Description Adds a rectangle to the path. ### Parameters - **rect** (Rect) - Required - Rectangle to add. ## addEllipse(rect: Rect) ### Description Adds an ellipse encapsulated by the provided rectangle. ### Parameters - **rect** (Rect) - Required - Rectangle encapsulating the ellipse. ## addRoundedRect(rect: Rect, cornerWidth: number, cornerHeight: number) ### Description Adds a rounded rectangle to the path. ### Parameters - **rect** (Rect) - Required - Rectangle to add. - **cornerWidth** (number) - Required - Horizontal size of the rounded corner. - **cornerHeight** (number) - Required - Vertical size of the rounded corner. ## addCurve(point: Point, control1: Point, control2: Point) ### Description Adds a cubic Bezier curve to the path. ### Parameters - **point** (Point) - Required - End point of the curve. - **control1** (Point) - Required - First control point. - **control2** (Point) - Required - Second control point. ## addQuadCurve(point: Point, control: Point) ### Description Adds a quadratic Bezier curve to the path. ### Parameters - **point** (Point) - Required - End point of the curve. - **control** (Point) - Required - Control point. ## addLines(points: [Point]) ### Description Adds straight lines between an array of points. ### Parameters - **points** ([Point]) - Required - Points to add lines between. ## addRects(rects: [Rect]) ### Description Adds a set of rectangles to the path. ### Parameters - **rects** ([Rect]) - Required - Rectangles to add. ## closeSubpath() ### Description Closes the current subpath by drawing a line to the start point. ``` -------------------------------- ### Get URL for running the current script Source: https://docs.scriptable.app/urlscheme Generates the URL to run the current script from another application. When requested, the script will execute in Scriptable. Query parameters can be accessed via `args.queryParameters`. ```javascript static forRunningScript(): string ``` -------------------------------- ### Open Callback URL Source: https://docs.scriptable.app/callbackurl Executes the request and waits for a response. The returned promise resolves with query parameters from the target app or rejects on failure/timeout. ```javascript open(): Promise<{string: string}> ``` -------------------------------- ### Rect Constructor Source: https://docs.scriptable.app/rect Information on how to construct a new Rect object. ```APIDOC ## new Rect() ### Description Constructs a new rectangle placed in a two-dimensional coordinate system. ### Parameters #### Path Parameters - **x** (number) - Required - X coordinate. - **y** (number) - Required - Y coordinate. - **width** (number) - Required - Width of rectangle. - **height** (number) - Required - Height of rectangle. ``` -------------------------------- ### Construct a New ListWidget Source: https://docs.scriptable.app/listwidget Initializes a new instance of the ListWidget class. ```javascript new ListWidget() ``` -------------------------------- ### Open documents with DocumentPicker Source: https://docs.scriptable.app/documentpicker Presents a picker to select files based on specified UTIs. ```javascript static open(types: [string]): Promise<[string]> ``` -------------------------------- ### Presenting Event UI Source: https://docs.scriptable.app/calendarevent Methods to open native views for editing or creating events. ```javascript presentEdit(): Promise ``` ```javascript static presentCreate(): Promise ``` -------------------------------- ### Font Constructor Source: https://docs.scriptable.app/font Constructs a new font instance with a specified name and size. ```APIDOC ## new Font(name, size) ### Description Constructs a new font instance. Refer to iosfonts.com for a list of available fonts. ### Parameters - **name** (string) - Required - Name of the font. - **size** (number) - Required - Size of the font. ``` -------------------------------- ### UITable Constructor Source: https://docs.scriptable.app/uitable Constructs a new instance of a UITable. ```APIDOC ## new UITable() ### Description Constructs a table to present data in a structured manner. ### Method Constructor ### Endpoint new UITable() ``` -------------------------------- ### System Font Weights Source: https://docs.scriptable.app/font Static methods to create system fonts with specific weights and styles. ```APIDOC ## Static System Fonts ### Description Creates system fonts with specific weights, styles, or monospaced variants. ### Parameters - **size** (number) - Required - Size of the text. ### Methods - `Font.systemFont(size)` - `Font.ultraLightSystemFont(size)` - `Font.thinSystemFont(size)` - `Font.lightSystemFont(size)` - `Font.regularSystemFont(size)` - `Font.mediumSystemFont(size)` - `Font.semiboldSystemFont(size)` - `Font.boldSystemFont(size)` - `Font.heavySystemFont(size)` - `Font.blackSystemFont(size)` - `Font.italicSystemFont(size)` - `Font.ultraLightMonospacedSystemFont(size)` - `Font.thinMonospacedSystemFont(size)` - `Font.lightMonospacedSystemFont(size)` - `Font.regularMonospacedSystemFont(size)` ### Return value - **Font** - The created font object. ``` -------------------------------- ### Retrieve all file bookmarks Source: https://docs.scriptable.app/filemanager Returns an array of objects representing all configured file bookmarks. ```javascript allFileBookmarks(): [{string: string}] ``` -------------------------------- ### Construct a New DatePicker Source: https://docs.scriptable.app/datepicker Initializes a new instance of the DatePicker component. ```javascript new DatePicker() ``` -------------------------------- ### Create System Font by Size Source: https://docs.scriptable.app/font Creates a system font with the specified text size. This is a general-purpose system font. ```javascript static systemFont(size: number): Font ``` -------------------------------- ### FileManager Creation Source: https://docs.scriptable.app/filemanager Methods to create instances of FileManager for local storage or iCloud. ```APIDOC ## +local Creates a local FileManager. ``` static local(): FileManager ``` Creates a file manager for operating with files stored locally. ### Return value _FileManager_ Local FileManager. * * * ## +iCloud Creates an iCloud FileManager. ``` static iCloud(): FileManager ``` Creates a file manager for operating with files stored in iCloud. iCloud must be enabled on the device in order to use this. ### Return value _FileManager_ iCloud FileManager. ``` -------------------------------- ### useFullTimeStyle Source: https://docs.scriptable.app/dateformatter Configures the time display to use a full style, including all time details and full time zone names. ```APIDOC ## useFullTimeStyle ### Description Use a full style for the time. Times with a full style includes all details, e.g. "7:16:42 PM Pacific Standard Time". ### Method This is a method call. ### Endpoint N/A (Client-side method) ### Request Example ```javascript useFullTimeStyle() ``` ### Response N/A (Modifies internal state) ``` -------------------------------- ### WidgetStack Methods Source: https://docs.scriptable.app/widgetstack Methods to add content and configure layout for a WidgetStack. ```APIDOC ## WidgetStack Methods ### Description Methods to add content and configure layout for a WidgetStack. ### Methods #### addText - **Description**: Adds a text element to the stack. - **Parameters**: - **text** (string) - The text to add. - **Returns**: WidgetText - Text element. #### addDate - **Description**: Adds a date element to the widget. - **Parameters**: - **date** (Date) - The date to add. - **Returns**: WidgetDate - Date element. #### addImage - **Description**: Adds an image element to the stack. - **Parameters**: - **image** (Image) - The image to add. - **Returns**: WidgetImage - Image element. #### addSpacer - **Description**: Adds a spacer to the stack. - **Parameters**: - **length** (number) - Length of the spacer. Pass null for flexible length. - **Returns**: WidgetSpacer - Spacer element. #### addStack - **Description**: Adds a stack to the widget. - **Returns**: WidgetStack - Stack element. #### setPadding - **Description**: Sets the padding on each side of the stack. - **Parameters**: - **top** (number) - Padding on the top edge. - **leading** (number) - Padding on the leading edge. - **bottom** (number) - Padding on the bottom edge. - **trailing** (number) - Padding on the trailing edge. #### useDefaultPadding - **Description**: Configures the stack to use the default padding. #### topAlignContent - **Description**: Specifies that content should be top aligned. This is the default. #### centerAlignContent - **Description**: Specifies that content should be center aligned. #### bottomAlignContent - **Description**: Specifies that content should be bottom aligned. #### layoutHorizontally - **Description**: Specifies that the stack should layout elements horizontally. This is the default. #### layoutVertically - **Description**: Specifies that the stack should layout elements vertically. ``` -------------------------------- ### Create Image from File Source: https://docs.scriptable.app/image Use the static `fromFile` method to load an image from a specified file path. Returns null if the image cannot be read. ```swift static fromFile(filePath: string): Image ``` -------------------------------- ### Export a file with DocumentPicker Source: https://docs.scriptable.app/documentpicker Exports a file at the given path to a user-selected destination. ```javascript static export(path: string): Promise<[string]> ``` -------------------------------- ### Importing a Module in Scriptable Source: https://docs.scriptable.app/module Use importModule to load a file as a module and access its exported functions. ```javascript let circle = importModule('circle') let r = 2 let area = circle.area(r) log('Area of circle: ' + area) ``` -------------------------------- ### Construct a Message Source: https://docs.scriptable.app/message Initializes a new instance of the Message class. ```javascript new Message() ```