I’m using a deprecated command ’ fullPath(forApplication appName: [String]’ and am trying to properly use the current version
Deprecated
Use urlForApplication(withBundleIdentifier:) instead.
current code:
set theWorkspace to current application's NSWorkspace's sharedWorkspace()
set thePath to (theWorkspace's fullPathForApplication:applicationName)
Non-functional updated code:
set theWorkspace to current application's NSWorkspace's sharedWorkspace()
set thePath to (theWorkspace's urlForApplication(withBundleIdentifier:applicationName))
--><Application_Bundle_ID>*** -[BAGenericObjectNoDeleteOSAID withBundleIdentifier]: unrecognized selector sent to object <BAGenericObjectNoDeleteOSAID @0x600002974260: OSAID(4) ComponentInstance(0x810015)>
use AppleScript version "2.4" -- OS X 10.10 (Yosemite) or later
use framework "Foundation"
use framework "AppKit"
use scripting additions
set theWorkspace to current application's NSWorkspace's sharedWorkspace()
set theURL to theWorkspace's URLForApplicationWithBundleIdentifier:"com.apple.Finder"
Thanks Nigel! I’m still unclear on how to read the docs and determine the proper structure for my calls. This is certainly not what I assumed given the docs. Hopefully It’ll click for me.
My more immediate frustration is why fullPathForApplication which took an application name was supplanted with urlForApplication which takes a Bundle Identifier. The code I’m updating returns a bundle ID given an application name. I don’t see any current methods in NSWorkspace that return an app url given an application name.