This site runs best with JavaScript enabled.

Using iOS Shortcuts App and Pythonista

Christopher Ueda

April 29, 2019

Dev Blogger


  • Purchase Pythonista for iOS.
  • Create a script in the Shortcuts App to take in an input or inputs and save them as variable(s). Pass those variables into an URL action that will open Safari with the Pythonista url scheme.
  • Create a Python script in Pythonista to receive those variables and process them as you like then save them to the iOS clipboard.

Shortcuts Script

Here's a simple script that takes a date and name input and sends them to a Pythonista script saved to my iCloud account. Each of the inputs are saved to a variable which is used as a value of an argv query parameter. Note that the order of the arvs query parameters matter. See the python script to see how they're used. The URL is built up like this: pythonista3://myPythonScript?action=run&root=icloud&argv=Name&argv=Date where 'myPythonScript' is the name of the script in Pythonista, and 'Name' and 'Date' are the variables from the Shortcuts script.

alt text

Python Code

2import sys, clipboard
4name = sys.argv[1]
5date = sys.argv[2]
6text = ''
8if name:
9 text = 'Hi {}! '.format(name)
11if date:
12 text += 'Are you free on {}?'.format(date)
Share article