In 2023, does Script Editor re-parse/change multi-year-old Applescripts?

Several years ago, I got into the practice of “locking” my Applescript Script Editor files after I got them working. It may have been some form of ‘Auto-save’ was getting in my way.

I felt that ‘new features’ were added to Script Editor years ago… which were intended to ‘help’ our scripting. (I found the re-parsing got in my way, and the feature rebuilt/destroyed many of my multi-year old Scripts when I opened them with the ‘new version’ of Script Editor, so I always ‘locked’ them when I was done, and things worked).

I cannot recall what the “feature” was that made me change my workflow into ‘locking’ my files while I was coding.

MY QUESTION IS…
In 2023 on an M1 running Monterey or Ventura… (or earlier macOSs), does Script Editor re-parse our content -or- ‘Auto-Save’, may be Time Machine versioning, or such ? – Or am I just losing my code (my mind) through some other feature I have yet to understand?

TODAY… my Locked .scpt files are creating issues Two-way syncing using Synology Drive Client.

Can I safely unlock my Applescript Script Editor files… or will .scpt files re-parse, then auto-save when I open them, or afterwards when I least expect it?

Thank you for your consideration.

The Script Editor its self isn’t re-writing your scripts. That was never a thing.

The AppleScript compiler may re-format the whitespace and line continuations within your scripts when you compile within the Script Editor.

There may also be terminology changes caused when an application changes its dictionary through software updates. These terminology changes will appear when you open your script and cannot be avoided (unless you store your script in plain-text form). These sorts of changes can also occur when opening very old scripts and there have been significant AppleScript changes in the intervening years.

The Script Editor did introduce the ability to go back in time to previous versions using Time Machine. But this is a feature you have to deliberately invoke.

I would recommend keeping good backups of your scripts. This way you can revert to a known state whenever you need to. If you really want you scripts to remain unchanged, save them in text (.applescript) form. The compiled script file types (.scpt, .scptd and .app) must be de-compiled when opened which is when terminology changes may take place.

TL-DR: nothing magic is happening. For compiled scripts, the decompiled content depends on many things, all of which may change through time.

Mark,

Thank you for your reply.

Thank you for your amazing work on updating MacScripter.net into 2023 and beyond.

Do you have a go fund me page or such?

MacScripter Donations

This does not necessarily answer your question but I was thinking that you may find this following AppleScript code somewhat useful.

This script allows you to choose a .scpt or .scptd file, then temporarily sets it as a “Stationary pad” file as if you click the check box “Stationary pad” in the Get Info window in Finder, for that file.

Now that that file is a “Stationary pad”, anytime you try to open it…it will open up a copy of that file instead… Leaving the original untouched. Then once the duplicated file is opened, it toggles “Stationary pad” back to off on the original.

activate
set theFile to choose file with prompt ¬
	"Choose a file to open as a \"Stationary Pad\" file." of type {"osas", "BNDL"}

tell application "Finder"
	set stationery of theFile to true
	open theFile
	set stationery of theFile to false
end tell
1 Like