Example - Passing a Value to a Shortcut Using Python

Posted on
Mon Mar 13, 2023 6:11 pm
DaveL17 offline
User avatar
Posts: 6751
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Example - Passing a Value to a Shortcut Using Python

Passing data to a Shortcut using Python is easy using an embedded script.

Code: Select all
import os

val = indigo.variables[123456].value
os.system(f'/usr/bin/shortcuts run "Post Event to Calendar" <<< \"{val}\"')
Note the escaped double-quotes for the shortcut payload. These are important to ensure that payloads with embedded spaces are sent as an encapsulated string object.

Apple Shortcut
Get Text From - Shortcut Input
Calendar - Add New Event

Screenshot 2023-03-13 at 6.56.59 PM.png
Screenshot 2023-03-13 at 6.56.59 PM.png (304.8 KiB) Viewed 416 times

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests