View Full Version : what to make of this?
This is not a problem (precisely) but it is something I've noticed that's odd. Suddenly in snow leopard, compiled applescripts (.scpt files) which are run via launchd or the command line using the osascript command get their modification dates changed (like running 'touch' on them). This does not happen to uncompiled scripts (.applescript files) run the same way. I'm trying to decide:
why this happens
whether this is something peculiar to my machine
whether this is a bug that's worth reporting to Apple
it has no ramifications for the script or the machine or anything, except that it bugs the f%ck out of me. does anyone else see this, and/or have any insights into it?
Red_Menace
06-16-2010, 06:58 PM
As far as I know this is normal, since data such as global variables and properties are saved with the script.
As far as I know this is normal, since data such as global variables and properties are saved with the script.
It's not a script application or bundle, just a plain old compiled script. I don't believe those save properties or globals (and this happens with scripts that don't set properties or globals anyway).
NovaScotian
06-16-2010, 07:39 PM
I agree with Red Menace; I don't think it matters whether anything is actually saved; that the script was opened for access and something might have been saved is enough. There is no comparison to see if something really did change, I don't think. Having said that, I do think it's a low level bug. After all if you open a script in the editor don't change anything and close it, it doesn't do that. Neither does quicklook although it probably opens them to read only.
Red_Menace
06-16-2010, 08:55 PM
It looks like it depends on how the script is called. For example, if you run it from the Script Editor, any changed properties/globals don't appear to be saved, but if you do something like run it from the Scripts Menu, the properties/globals are saved with the script. Also note that the globals saved include anything at the root level of the script object, such as variables defined in an implicit run handler.
well, hunh. I guess I'll just have to put this down in the weirdness file. :D
Hal Itosis
06-17-2010, 01:48 PM
A small example .scpt file to play with would be nice... along with the exact call syntax from bash.
A small example .scpt file to play with would be nice... along with the exact call syntax from bash.
well, I looked at the scripts where the issue occurred, and they all do have property statements. Even something as simple as this:
property x : missing value
tell application "Finder" to display dialog "hello"
will get its modification date changed with each run. and in fact, the scripts retain changes in property values across runs. that didn't use to be the case - it used to be that you needed to make a script application to maintain script properties. is that something new to 10.6, or was that there in 10.5?
now I have to check my old scripts to see if that behavior is goofing anything up...
Red_Menace
06-17-2010, 07:46 PM
It's been like that for as long as I can remember. It comes up from time to time, usually when someone uses a large list or text variable and the script complains when it can't save it. As I mentioned before, any global will be saved, for example:
try
get X
on error -- first run
set x to "X has been set to \"hello\""
set Y to 1
end try
display dialog X & " (" & Y & ")"
set X to "hello there" -- for next run
set Y to Y + 1
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.