Automation with Shortcuts and x-callback URLs¶
Pyto provides Shortcuts for running scripts and code. Shortcuts will open Pyto to execute the code and it’s not possible to retrieve the result. See x-callback URLs for getting callbacks.
Run Code will execute the given code with the given arguments. Can be executed in app or without leaving Shortcuts.
Run Script will execute the given script with the given arguments. Can be executed in app or without leaving Shortcuts.
Get Script Output will wait for a script to be executed and returns its output.
Pyto supports x-callback URLs for running scripts from other apps and getting the result.
With this method you can only run code and not a script but you can use the runpy module for running scripts in a location like
This is the structure that should be used for running code:
code is the code to execute.
x-success is the URL to open when a script was executed successfully. Passes the output (stdout + stderr) to a
x-error is the URL to open when a script raised an exception. Passes the exception message to a
x-cancel is the URL to open when a script was stopped by the user or when the script raised
The Shortcuts app supports opening x-callback URLs. Here is an example of a Shortcut that shows the current Python version.