• 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: Robert Tillyard <email@hidden>
  • Date: Tue, 25 Jan 2005 00:59:11 +0000

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


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

  • Prev by Date: Re: Database
  • Next by Date: Document bundles and rude users
  • Previous by thread: Re: NSWorkspace launchApplication withArguments?
  • Next by thread: Re: NSWorkspace launchApplication withArguments? (Possibly Solved?)
  • Index(es):
    • Date
    • Thread