Am I right in guessing that if we distribute AppleScripts that use (for example) Perl, we’ll have to start including a copy of Perl inside the script applet? If so, are there any suggestions about the best way to do this?
Yes, you will have to include copies. I don’t know that it will matter too much where you put them — /Contents/macOS or /Contents/Helpers are the logical place. They shouldn’t go in /Contents/Resources, although they may work there.
It’s going to make maintenance difficult — you might be better to access them via script libraries, which you can then embed just before distributing. And it’s probably a good time to see if you really need them in all cases.
Yes, I see that substitutes should be available. For example, I use this code to test for the Option key being held down (code found on this forum, I think):
if (do shell script “/usr/bin/python -c 'import Cocoa; print Cocoa.NSEvent.modifierFlags() & Cocoa.NSAlternateKeyMask '”) > 1 then
my setOptions()
end if
But I see that this alternative should be possible also: