I’ve not been able to understand all the posts on this thread but, in case it’s relevant, I found last year that editing DTP 1.1.3 in Script Editor works but editing in Script Debugger results in the “NSThread doesn’t understand the “isMainThread” message
” error. I could not find out why. But, I’ve not had the error since.
@dean one other thing you could test: change the OSAAppleScriptObjCEnabled
entry to NO
. If the value is being read, that should guarantee 100% failure rate. If it works at all, it would suggest something more complicated is going on.
Votes are in it absolutely resolved the issue. See the other post too.
I can confirm that, since a couple of month now, all my librairies has the OSAAppleScriptObjCEnabled
set to yes and I never encounter this issue again.
So, for those of us who are having this same issue with running scripts in FastScripts and other menus, the solution seems to be to locate the plist file for the libraries and set OSAAppleScriptObjCEnabled to yes.
Is that correct?
EDIT: Found my error in previous script. This version works.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
use script "filemanagerlib"
property ASOBJCEnabledPrefKey : "<key>OSAAppleScriptObjCEnabled</key>"
property ASOBJCEnabledPrefValue : "<true/>"
on open fileList
repeat with thisFile in fileList
set nameExtension to name_extension of (parse object thisFile with HFS results)
if nameExtension is "scptd" then
set scriptLibrariesFolder to (thisFile as text) & "Contents:"
set libFileList to objects of scriptLibrariesFolder ¬
searching subfolders false ¬
include folders false ¬
include files true ¬
result type files list
repeat with aLibFile in libFileList
set nameExtension to name_extension of (parse object aLibFile)
if nameExtension is "pList" then
my UpdatePListFile(aLibFile as alias)
end if
end repeat
else if nameExtension is "app" then
set scriptLibrariesFolder to (thisFile as text) & "Contents:Library:Script Libraries:"
set libFileList to objects of scriptLibrariesFolder ¬
searching subfolders false ¬
include folders false ¬
include files true ¬
result type files list
open libFileList
end if
end repeat
end open
on UpdatePListFile(pListfile)
local pListfile
set pListInfo to read (pListfile)
if ASOBJCEnabledPrefKey is not in pListInfo then
set AppleScript's text item delimiters to {"<dict>"}
set pListInfo to text items of pListInfo
set ASOBJCEnabledPref to return & tab & ASOBJCEnabledPrefKey & return & tab & ASOBJCEnabledPrefValue & return
set item 2 of pListInfo to ASOBJCEnabledPref & item 2 of pListInfo
set pListInfo to pListInfo as text
try
set openFile to open for access file pListfile with write permission
on error errMsg number errNum
close access file pListfile
set openFile to open for access file pListfile with write permission
end try
set eof of openFile to 1
write pListInfo to openFile
close access openFile
set pListInfo to read pListfile
end if
end UpdatePListFile
I would have it copy a new version renamed. I added modded to mine with the plist, update permissions on contents to read/write and just have it use the new one if your exporting as run only. I’m sure @ShaneStanley will chime in.