NOTE: Same script worked in earlier versions of OS (Mojave,high Sierra,etc). Seeing this problem only in Catalina
I need to use Foundation framework for making some objc related calls in scripts. After I add this line loading script files and throws below error
Can’t make current application into type file.
After removing use framework “Foundation”, it works fine
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
use framework "Foundation"
set Lib to load script POSIX file "/Library/Application Support/iManage/script/Utilities.scpt"
Should I use different way to load script when using foundation framework.
You have to use file specifiers differently when you include a use framework statement. This isn’t Catalina specific; your script (with different path) fails here under 10.14, too.
The solution is to use coercions rather than specifiers. So:
set iManageLib to load script ("/Library/Application Support/iManage/script/iManageUtilities.scpt" as POSIX file)
In this particular case, with a POSIX path you probably don’t need a specifier at all:
set iManageLib to load script "/Library/Application Support/iManage/script/iManageUtilities.scpt"
The same thing happens with the specifier file, although the fix is a bit different there.
(You can format your code here by putting lines consisting of thee back-ticks (that’s ```) before and after. I’ll edit your post as an example.)
Where can I get this information about using file specifiers when we include use framework statement. All my scripts are working fine before and I see these issues only after I upgraded to Catalina beta. I am facing issues with using alias as well
set the defaultDestinationFolder to "/Library/Application support/example" set destinationfolder to ((defaultDestinationFolder) as alias)
I see below error
Can’t make “/Library/Application support/example” into type alias.