• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSWorkspace launchApplication withArguments? (Possibly Solved?)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSWorkspace launchApplication withArguments? (Possibly Solved?)


  • Subject: Re: NSWorkspace launchApplication withArguments? (Possibly Solved?)
  • From: Darkshadow <email@hidden>
  • Date: Tue, 25 Jan 2005 08:57:02 -0500

Hmm, that won't always work. What if the user doesn't have write permission to the application bundle, or if the application is located on some read-only media? The write will fail in either of these cases, and the code won't be run.

You could write it to the Application Support folder, or since it's something you're removing anyway, you could write it to /tmp as well.

Darkshadow (aka Michael Nickerson)

On Jan 24, 2005, at 7:59 PM, Robert Tillyard wrote:

On 24 Jan 2005, at 5:13 pm, Clark Cox wrote:

On Mon, 24 Jan 2005 17:01:39 +0000, Robert Tillyard
<email@hidden> wrote:
I've found in the documentation that to launch a GUI application from
my app I need to use...

[[NSWorkspace sharedWorkspace] launchApplication:@"OtherApp"];

From previous discussion on this list it appears that NSTask shouldn't
be used to run a GUI application but how would I run and pass command
line arguments to a GUI application?

In general, you don't; Most GUI apps aren't written with receiving command line arguments in mind. Additionally, what would you do if the application was already running? There are other ways to pass information to GUI applications (Distributed Objects, AppleEvents, POSIX Pipes, Raw Sockets, Shared Memory, etc.).

--
Clark S. Cox III
email@hidden
http://www.livejournal.com/users/clarkcox3/
http://homepage.mac.com/clarkcox3/

Thanks for your reply, it's saved me from scanning documentation and pile of Cocoa books for hours on end thinking that I must have missed something.


I've got around it by creating a thread that writes a UNIX command line for the program I want to run then use chmod() to make it executable and then use system() to run it before using unlink() to remove the file.

system() has an advantage in that I wanted to do a [task waitUntilExit]; anyway and system() causes the thread to wait until the program exits.

The program I wanted to run is called by running:

/path/tp/myapp/myapp.app/Contents/MacOS/myapp

Thanks, again for your help.

Regards, Rob.

_______________________________________________
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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

References: 
 >NSWorkspace launchApplication withArguments? (From: Robert Tillyard <email@hidden>)
 >Re: NSWorkspace launchApplication withArguments? (From: Clark Cox <email@hidden>)
 >Re: NSWorkspace launchApplication withArguments? (Possibly Solved?) (From: Robert Tillyard <email@hidden>)

  • Prev by Date: Re: setfile problem
  • Next by Date: Re: Database
  • Previous by thread: Re: NSWorkspace launchApplication withArguments? (Possibly Solved?)
  • Next by thread: Don't draw Focus Ring?
  • Index(es):
    • Date
    • Thread