.applescript development

I just discovered that it was totally possible to work with .applescript text files in SD, and compile/run/modify them as text files.

Which means that version control is totally possible, with the .applescript file, and that the compiled version as whatever can run automatically can be saved and used separately.

I am just one bit closer to total happiness now :slight_smile:

(On a separate note: for those of you who want to read something trivial about how hard it is to start being productive with AS, I’ve just written an introduction to my adventures in automation land here:
http://mac4translators.blogspot.jp/2017/10/applescript-everywhere.html)

When making changes to my bigger scripts I also work like this. Any changes are first going to the “source” file (an .applescript text file under version control), and once I’m content I commit and paste the script text to the “release” file (the .scpt or .scptd or KM macro, LB action, whatever).

(Of course, sometimes also intermediate test-runs can only be done in the release file, depending on the context. But this is quickly done by copy-pasting the text.)

So, yes, .applescript (text) files are a great thing!

Is there not a VCS that will handle .scpt and .scptd files directly?

What about DropBox as a Simple VCS?

FWIW, I use DropBox, which keeps a version of each file for 30, 90, 120, or unlimited days, depending on your account type. Even the free version provides 30 days.

While not nearly as powerful as a full-blown VCS, I have found it works very well for me, making it easy to find any restore any file, including .scpt and scptd files. The good part is I don’t have to do anything – it automatically saves a historical copy every time I save the file.

All of my AppleScript files, including script libraries, are in the DropBox folder on my Mac. So they are all auto-backed up, but also immediately available on all of my Macs.

Hi Jim,

I don’t have Dropbox installed at the moment, but I think what it does is just a backup that retains multiple versions of the file.

You can do this with virtually any backup program: rsync, ChronoSync, CCC, Arq, Time Machine, etc. To some extent the macOS does this even natively for you (To see the versions: Apple’s Script Editor: File > Revert to…).

A VCS (like Git, HG, Fossil, etc.) shows you the diffs in the file’s history, you can make branches, you can stash changes, you can merge, etc. To use .scpt files with a VCS I think the files would have to be decompiled before each commit. You can certainly script that (see some posts in this discussion) but this adds quite some complexity, compared to simply using .applescript text files.

1 Like

Indeed, the idea behind version control is not so much to have a backup, but to have a granular view of how the document evolved.

That is correct.

Yes, but with DropBox it is automatic with every save I make of a file. No backups to run.

I’m sure that’s true. That’s why I said:

I get that. I just don’t need that feature that often. When I do, I have a file difference tool that will do the job for me.

But no doubt, if you’re doing heavy-duty development with many source files, then a VCS is definitely the way to go. I have used them in the past.

All I’m saying is that for some, like me, DropBox auto-backup might be all you need. That is one of the features of DropBox that I like, but not the primary reason I use it.

1 Like

Jim,

I just became used to use git or whatever is fashionable in the places where I lurk, because every time you want to make a suggestion the reply ends up being “send a PR” or similar. Also, I can see how DropBox can be used for sharing documents, but for even basic VC, macOS seems to have more interesting features. But now, I don’t know how you use DP in the first place, and if you use it, you probably have a good reason :slight_smile: