Can you launch Tor Browser by its id?

tell application id "org.mozilla.tor browser" to launch

used to work (actually it launches Firefox and sometimes it’s hidden) but now only

tell application ":Applications:Tor Browser.app" to launch

seems to do.

I could also use open, I guess

do shell script "open -a 'Tor Browser'"

Are there any other workarounds for pesky applications such this?

Hello.

I think you have covered the bases pretty well, but maybe the last resort is to execute the binary that resides inside “Applications/AppFolder/Contents/MacOs”, this can be interesting if you want to pass parameters to the executable during startup.

Another syntax


launch application (path to application "Tor Browser" as text)

path to current application as text
		--> error number -1708

which is, an Apple Event was not handled by any handler. What does it mean in this context?

current application represents the current AppleScript environment, not the frontmost application

Does anyone know why this doesn’t work?

tell application id "org.mozilla.tor browser" to launch

Shouldn’t it be like double-clicking the application bundle in Finder?

run this to check if the bundle identifier is spelled correctly


set {TID, text item delimiters} to {text item delimiters, return}
tell application "System Events"
	set mozillaProcesses to (get name of processes whose name contains "mozilla") as text
end tell
set text item delimiters to TID
display dialog mozillaProcesses

It sees nothing

tell application "System Events"
	get name of every process whose name contains "mozilla"
		--> {}
end tell
tell application "AppleScript Editor"
	display dialog ""
		--> {button returned:"OK"}
end tell
Result:
{button returned:"OK"}

Anyway, the Info.plist states

I think stefan meant:

set {TID, text item delimiters} to {text item delimiters, return}
tell application "System Events"
	set mozillaProcesses to (get bundle identifier of processes whose bundle identifier contains "mozilla") as text
end tell
set text item delimiters to TID
display dialog mozillaProcesses

I guess the space character in the bundle identifier causes the problem

Yes, of course :wink:

That was my first guess, too. But quoted or escaped it should work.

tell application "System Events"
	get bundle identifier of every process whose bundle identifier contains "mozilla"
		--> {"org.mozilla.tor browser"}
end tell
tell application "AppleScript Editor"
	display dialog "org.mozilla.tor browser"
		--> {button returned:"OK"}

(Sigh)

The problem is that Mozilla does not conform to the bundle identifier naming convention

From the documentation:
The bundle ID string must be a uniform type identifier (UTI) that contains only alphanumeric (A-Z,a-z,0-9), hyphen (-), and period (.) characters. The string should also be in reverse-DNS format.

Does the path-to-application solution not work?

Thanks for the doc reference.

Path-to-application is nice, but it’s very slow. In Script Debugger

tell application (path to application "Tor Browser" as text) to launch

takes ±2.15"

tell application "Tor Browser" to launch

takes ±0.09"