×

Run Inline Script

iOS 14 +

Notes

Runs a script in Scriptable. The parameter can be accessed using args.shortcutParameter. This parameter can be a text, list, dictionary or a file. When passing a file as input the action will attempt to read the file as JSON or a plain text. If the file cannot be read as JSON or plain text, a path to the file will be passed instead. Use args.plainTexts, args.images, args.urls and args.fileURLs to read the other input parameters. When passing large images and files as input, the script may fail due to memory constraints. In that case you should enable "Run In App". Use JavaScript's "return" keyword or Script.setShortcutOutput() to output a value. In case you don't output a value, add Script.complete() to indicate that your script have finished running.

Syntax

runScriptInline(script: <#String (Allows Variables)#>, parameter: <#Variable Array#>, texts: <#Array#>, urls: <#Unknown Parameter#>, images: <#Variable Array#>, files: <#Variable Array#>, runInApp: <#Boolean#>)

Example

runScriptInline(script: "console.log('Hello World');", parameter: Clipboard, texts: [Red, Blue, Green], urls: ["https://jellycuts.com"], images: image, files: file, runInApp: false)