Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > I have an easy question (I hope).

I have an easy question (I hope).
Thread Tools
Xeo
Moderator Emeritus
Join Date: Mar 2001
Location: Austin, MN, USA
Status: Offline
Reply With Quote
May 10, 2001, 02:52 AM
 
Code:
@implementation TestApp - (IBAction)something :(id)sender { test = [[NSTask alloc] init]; [test setLaunchPath:@"/test"]; [test launch]; } @end
Now, all I want to do is put what [test launch] returns into a text box. I see the result in the "Run" tab. I don't know how to make it work with a text box.

Let's assume my text box is named "textBox"

I've tried adding the code: [textBox setStringValue:[test launch]; but that doesn't work. I've also tried adding a text string, called "textstring" and I did something like this (added the code in bold to the code above):
Code:
@implementation TestApp - (IBAction)something :(id)sender { test = [[NSTask alloc] init]; [test setLaunchPath:@"/test"]; [test setStandardOutput:textstring]; [test launch]; [textBox setStringValue:teststring]; } @end
This doesn't work.

Any help?

[edit: smilies get me every time]
------------------


[This message has been edited by Xeo (edited 05-10-2001).]
     
Senior User
Join Date: Nov 2000
Status: Offline
Reply With Quote
May 10, 2001, 09:31 AM
 
See NSPipe.
     
Xeo  (op)
Moderator Emeritus
Join Date: Mar 2001
Location: Austin, MN, USA
Status: Offline
Reply With Quote
May 10, 2001, 10:24 AM
 
If you'll notice, I have another thread asking about how to use NSPipe...

How about you show me how to use it. I am having a hell of a time trying to get it working by reading about it.

------------------
     
Fresh-Faced Recruit
Join Date: Sep 2000
Location: Germany
Status: Offline
Reply With Quote
May 10, 2001, 01:54 PM
 
I uploaded a very simple solution to http://www.blackmac.de/manthor/download/twrap.tar.gz

Have fun!

------------------
Phure (aka BlackMac.de)
He who knows does not talk - He who talks does not know!
Phure (aka BlackMac.de)
He who knows does not talk - He who talks does not know!
     
Xeo  (op)
Moderator Emeritus
Join Date: Mar 2001
Location: Austin, MN, USA
Status: Offline
Reply With Quote
May 10, 2001, 02:12 PM
 
Thank you Stefan!! Exactly what I needed to get going.

Thank you soo much!

------------------
     
Senior User
Join Date: Nov 2000
Status: Offline
Reply With Quote
May 13, 2001, 12:42 AM
 
Sorry, I wasn't trying to be rude...

Real life can really get in the way sometimes. I had about 3 seconds to post when I thought I'd have 10 minutes. And since then I haven't really been able to get back on here. I had planned on a more detailed post 'cause I fumbled through using NSTask/NSPipe too. So, anyway, the best I could come up with was what I posted.

Maybe I should've said, "man popen" and "man system"? Those can be really useful when you don't need everything NSTask offers. Also, when in doubt, search Omni's MacOSX-dev list.

Glad you got what you needed, anyway!
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 10:02 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2