Is there a way of writing scripts on macOS

I’d like it if there was a way to write scripts on my MacBook and then copy/sync them across to my iPhone. Is this possible?

What sort of scripts do you want to write? Scriptable (JavaScript), Pythonista (Python), something else?

iCloud Drive can help with that sort of thing if you can figure out the right folder path.

Scriptable scripts, my iPhone screen is tiny, which is fine if I’m fixing or treaking something. But if I’m writing a new script from scratch I’d rather do that on my laptop.

Sure you can, using the share sheet extension.

(1) Edit your script on your computer in your preferred text editor or IDE.

(2) On your computer, save the file in a cloud directory that you can browse in the iOS Files app… for example, save MyScript.js to Dropbox or iCloud Drive.

(3) In iOS, us the Files app to browse that folder and find that file. Long-press on that file to bring up the context menu and choose Share.

(4) In the Share modal window that pops up, the row of icons with all the apps in it may have the Scriptable extension in it. If you do not see it there, then click on the ellipses button (…) to view more apps. You should see a “Copy to Scriptable” share-sheet extension there. You may choose it now, or you can click Edit and then the green plus button (+) to add Scriptable to the Share sheet for future convenience.

(5) When you choose the “Copy to Scriptable” action, your script will open in Scriptable, and you will have the option to add it to your device’s local scripts. Note that any changes you now make to the file are on the local copy only, not the original file that you stored in the cloud folder. They are not linked or synced in any way.

I hope that helps!

I just open them from iCloud Drive and they sync automatically.

2 Likes

On the Mac side, I recommend CodeRunner - for scripting, it’s simple and elegant. I use it whenever I need to write anything longer than a few lines in Drafts it Pythonista.

This works very well, my only gripe so far is sometimes it can take my devices a little while to “sync up”.

But its a very simple approach.

Thanks :slight_smile:

That’s the nature of having multiple synchronised sources for offline use vs. a single online only source. True near-time sync is possible, but it requires a higher level of power consumptions and stable (usually dedicated point-to-point) connectivity. Neither of these is likely a perfect match once you introduce something as mobile as an iPhone, and not one you could currently offer to consumers at scale for a reasonable cost.