re: launch safari to open an url
re: launch safari to open an url
- Subject: re: launch safari to open an url
- From: Craig Hunter <email@hidden>
- Date: Sun, 15 May 2005 18:46:11 -0400
> Message: 2
> Date: Sun, 15 May 2005 00:08:14 -0300
> From: Hernan Ochoa <email@hidden>
> Subject: launch safari to open an url
> To: email@hidden
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=ISO-8859-1
>
> I have a command-line tool that uses the Core framework.
>
> Can I use NSWorkspace from such an application?
>
> I'm trying to launch Safari and open and url with it.
> I've tried doing this with execl(), but it is impossible.
> ./Safari http://www.google.com results in Safari opening
> file://current_directory/http://www.google.com.
> very frustrating.
>
> so, I finally was able to do it with NSWorkspace openUrl:withApplication:.
>
I don't know if this helps you any, but there is an "open" command in the
shell that will process URLs quite nicely (and open any sort of document
too). Adding the "-a" flag lets you specify which app to use in the open
command. Using "open ." will open directories in the Finder. Lots of other
cool things you can do with this command, even use it to effectively switch
frontmost apps, show apps, etc... from programs that have no other direct
way to talk with the window manager. Try looking at the man page for "open"
in the shell. I have used this approach to launch help URLs from within
FORTRAN command line programs, just by passing the open command and proper
arguments to the shell using system calls.
Craig
--
Dr. Craig A. Hunter
NASA Langley Research Center
AAAC / Configuration Aerodynamics Branch
(757) 864-3020
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden