Code: Select all
;-TOP by mk-soft, v1.01.0, 11.03.2023
Procedure.s URLForApplicationWithBundleIdentifier(Indentifier.s, Full = #False)
Protected NSPool = CocoaMessage(0, 0, "NSAutoreleasePool new")
Protected NSWorkshare = CocoaMessage(0, 0, "NSWorkspace sharedWorkspace")
Protected NSUrl, NSPathString, Path.s
NSUrl = CocoaMessage(0, NSWorkshare, "URLForApplicationWithBundleIdentifier:$", @Indentifier)
NSPathString = CocoaMessage(0, NSURL, "path")
If NSPathString
Path = PeekS(CocoaMessage(0, NSPathString, "UTF8String"), -1, #PB_UTF8)
EndIf
If Full
If GetExtensionPart(path) = "app"
Path = path + "/Contents/MacOS/" + GetFilePart(path, #PB_FileSystem_NoExtension)
EndIf
EndIf
CocoaMessage(0, NSPool, "release")
ProcedureReturn Path
EndProcedure
terminalApp.s = URLForApplicationWithBundleIdentifier("com.apple.Terminal", #True)
Debug terminalApp