I’m migrating to OS 11 and having an issue with a few scripts. One gets the application file from a process in System Events.
It looks like an alias, but it won’t coerce to text, it won’t coerce to alias, it won’t let appleScript see if it’s in a list.
But it will coerce to a POSIX path.
Is this a sign that alias is on the way out?
→ Script Debugger 8.0.1 (8A36)
→ Mac OS 11.4 (20F71)
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
tell application "System Events"
set thisApp to application process "Script Debugger"
set applicationFile to application file of thisApp
end tell
try
applicationFile as text
on error errMsg number errNum
display dialog errMsg
end try
try
applicationFile is in {}
on error errMsg number errNum
display dialog errMsg
end try
try
applicationFile as alias
on error errMsg number errNum
display dialog errMsg
end try
try
POSIX file applicationFile
on error errMsg number errNum
display dialog errMsg
end try
Shane suggests «class furl» as a possible workaround.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
tell application "System Events"
set thisApp to application process "Script Debugger"
set applicationFile to (application file of thisApp) as «class furl»
end tell
try
applicationFile as text --> "Macintosh HD:Applications:Script Debugger.app:"
on error errMsg number errNum
display dialog errMsg
end try
try
applicationFile is in {} --> false
on error errMsg number errNum
display dialog errMsg
end try