I’ve recently upgraded from OS X 10.9.5 to OS 10.12.6. When I did, my complex Applescripts broke. Specifically, my scripts can no longer see their libraries.
For example, one of the library files that I use is in a file called: server properties.scpt
In that script file, I have defined:
script serverPropertiesLibrary
-- server properties
property odbcUser : "bob"
—
end script
I access that library in this example call:
repeat with loopProjectSet in ProjectSets
updateReport(loopProjectSet, serverPropertiesLibrary’s AffiliateSets, serverPropertiesLibrary’s odbcUser, serverPropertiesLibrary’s odbcPass, serverPropertiesLibrary’s extranetusername, serverPropertiesLibrary’s extranetpassword)
end repeat
When I run my scripts, either as applications from the Finder, or inside Script Editor or Script Debugger, I get the error (pointing to the first instance of serverPropertiesLibrary’s):
Applescript Error:
The variable serverPropertiesLibrary is not defined.
I Googled the issue the best I could, and did read up on setting the environment variable to point to the /opt/local/Script Libraries and /usr/local/Script Libraries . I added that env variable to my bash profile, and I can see the ENV variable set after my reboot (just to be sure):
dev:~ cameron$ env
… snip
OSA_LIBRARY_PATH=/opt/local/Script Libraries:/usr/local/Script Libraries
… and I confirmed that the scripts are in place:
dev:~ cameron$ ls -alG “/opt/local/Script Libraries”
total 8376
drwxr-xr-x 10 cameron wheel 340 7 Sep 21:43 .
drwxr-xr-x 16 cameron wheel 544 7 Sep 21:43 …
-rw-r–r–@ 1 cameron wheel 6148 7 Sep 21:43 .DS_Store
-rw-r–r–@ 1 cameron wheel 1825928 5 Apr 2015 Script Library Aliases
-rw-r–r–@ 1 cameron wheel 5510 21 Apr 2016 server properties.scpt
-rw-r–r–@ 1 cameron wheel 92514 6 Apr 2015 subroutines-excel.scpt
-rw-r–r–@ 1 cameron wheel 32562 15 Aug 2014 subroutines-mail.scpt
-rw-r–r–@ 1 cameron wheel 19420 23 Jul 2013 subroutines-progressbar.scpt
-rw-r–r–@ 1 cameron wheel 121624 4 Jan 2015 subroutines-status report cloner.scpt
-rw-r–r–@ 1 cameron wheel 92360 6 Apr 2015 subroutines.scpt
Still, my script won’t run, same error. Is that bash env variable just not accessible to my logged in GUI user account? Do I need to migrate all my libraries into the script’s bundle (completely defeating the purpose of libraries)?
Sorry to bother the group is this has been covered in the past, I just can’t wrap my head around this silly issue.
Thank you for your help.