A simple bug causing a hang requiring relaunch

With this issue if I start with a compiled script, that includes a scripting addition call, then add a “use script” command along with a “use scripting additions” command I get a hang that doesn’t end and I have to force quit.

Start with this script and compile and run it:


set junkMailInfo to  {} -- in the actual script this is a 300+ lists with three items each but it hangs with an empty list

set dataFileLocation to path to application support from user domain

add this at the top:


 use script "filemanagerlib"
use scripting additions

Compile the result. Hang.

This seems so simple it’s hard to believe I haven’t come across it before.

After the force quit the Apple bug reporter appeared:

Here’s a sample taken while it was hung:

Update, after taking the sample the hang went away and I was able to compile and run.

The samples point to a hange within AppleScript as it compiles your script. It appears to be trying to locate the library.

I don’t know if this is related or not, but this is the second time this has happened. I work on the same script at home and at work, keep the most recent version on DropBox.

At work I open the script which contains this line:

use script "FileManagerLib" version "2.2.1"

The first time this happened a few days ago, I was surprised because I thought I had the most recent version on both systems. I didn’t investigate further and simply redownloaded and reinstalled FileManagerLib.

Well, it’s happening now.

Compile Error: Can’t get script “FileManagerLib” whose version ≥ “2.2.1”.

I’ve verified that version 2.2.1 is installed (using finder’s get info and I actually opened the script (aren’t Shane’s libraries usually run-only?). *

So the first time it happened I was in a bit of a rush and I removed the version and went on with my scripting and redownloaded and reinstalled a little later.

It may have been after that I was getting this hanging but where I had to force quit.

  • (also, I had a glitch using Open quickly. I did a search for “FileManagerLib” and it showed the one in user script libraries folder. I clicked the Info button and it showed the preview version of the script I had open. Closed that and clicked info again and it showed the preview version of “FileManagerLib”

–> Script Debugger 7.0.3 (7A55)

–>Mac OS 10.11.6 (15G20015)

That’s all AppleScript’s doing. FWIW, I’ve thought I’ve caught it out a couple of times, but it’s always ended up being me. (Forgetting to dirty the script and recompile after adding a new version catches me regularly; libraries get cached.)

No. A couple are where they involve an embedded custom framework, but where possible I distribute them fully editable. I just ask that if people modify them, they use a different name.

Objective-C frameworks have a structure that requires the use of links, and they can pose problems for Dropbox. Short version: be careful when updating any libraries that contain embedded frameworks in folders under Dropbox control. It’s safer to remove the old version everywhere, before adding the new one.

That wasn’t very useful. What I mean is that AppleScript itself produces that error if it can’t find the library — Script Debugger isn’t involved.

Well, first, the point is to give you and Mark information that’s helpful to you…

Second, your comment was helpful. In both cases appleScript is having an issue locating a library that is exactly where a library should be.

One case caused an SD hang, the other case triggered an error alert.

Since the error alert is preferred over a hang, I’m wondering if there’s a way SD can not get hung when AppleScript is having this issue?

I suspect there’s not much can be done about the “hang”, which is really just waiting for an answer from AppleScript.

It seems odd, don’t most waiting for appleScript time out? This goes on until I force quit.

It should time out. But the fact that you reckon the right library is present suggests there might be a bit more too it.