I have a script that I use to launch an application with some options. The question revolves around these two statements
do shell script "/Applications/Firefox.app/Contents/MacOS/firefox-bin -ProfileManager &"
return
The statement launches Firefox’s profile manager and then after I select a profile Firefox launches. The problem is that the Applescript just sits there running and never executes the “return” to stop.
Any thoughts on this?
Model: Mac Pro
AppleScript: 2.1.2
Browser: Firefox 4.0b7
Operating System: Mac OS X (10.6)
Open will open the bundle.app and will look for the info.plist file. here it finds the executable in this file (on my machine its firefox-bin) and will launch it just like the finder does. The only advantage is that people with tweaked or other versions of firefox (where the file is named different) your script doesn’t work. I’ve also seen apps with more than one file in MacOS folder then again open will always opens the same version as the finder. I’m also suprised that FF don’t do this in their documentation
It’s probably not in the documentation because ‘open’ is an OS X specific command that isn’t available on other platforms and the writers may not have been aware of it. It’s basically the same as double-clicking a file in the Finder.
To be quite safe in situations where the user may have put Firefox in a different place, the best way to do it is:
do shell script “open -b org.mozilla.firefox --args -ProfileManager”
–args passes the remaining arguments to Firefox rather than trying to use them as arguments of ‘open’ itself. For more info, check the man page for open.
set theResult to text returned of (display dialog "Command to man:" default answer "")
do shell script ("man -t " & (quoted form of theResult) & " | open -f -a /Applications/Preview.app")
Good question, although -f does say “opens the results in the default text editor” so I guess we shouldn’t complain. It’s just odd that -fa works while -fb doesn’t.
Note that -a doesn’t need the full path to the app, you can just put “-a Preview”.