New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Call a script from Obj-c (or Xcode/Cocoa)


Post Reply New Thread Subscribe

 
Thread Tools
Konan

 
Member Since: Sep 11, 2008
Posts: 61
Konan is an unknown at this point

Konan is offline
I have started learning Xcode as of the 3.0 release. My C coding experience is years old but it is coming back. I just need to tack on the Objective-c part. Time is all I need.

But, I have years worth of scripts (mostly perl) that I definitely don't want to rewrite into obj-c. I can easily call a Obj-c executable from Perl, but so far I haven't managed to call a perl script from inside of Obj-c. I suspect that I am not seeing the forest for the trees and the method is so simple that I am overlooking it.

Note: I am not trying to integrate Perl inside of Xcode as in using Camelbones or suchlike. Just a simple call to an external program and return.

Anybody got an example?
Konan
QUOTE Thanks
xstep

 
xstep's Avatar
 
Member Since: Jun 25, 2005
Location: On the road
Posts: 3,231
xstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to all
Mac Specs: 2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid

xstep is offline
system( "cat /dev/null > /tmp/mymd5s" );
or
system( [myNSStringCommand UTF8String] );

Of course that won't return any values except the status, I think. You'd have to read the output from a file.

You might want to look into NSTask and NSPipe.

CameraTime - Time lapse photography for novice and advanced users.

When asking questions, post the version of your software. You'll receive better answers.

Please post your results to the thread as it is good feedback.
QUOTE Thanks
Konan

 
Member Since: Sep 11, 2008
Posts: 61
Konan is an unknown at this point

Konan is offline
Quote:
Originally Posted by xstep View Post
system( "cat /dev/null > /tmp/mymd5s" );
or
system( [myNSStringCommand UTF8String] );

Of course that won't return any values except the status, I think. You'd have to read the output from a file.

You might want to look into NSTask and NSPipe.
Hmmm. System is what I was trying. Must have gotten the syntax wrong.

Anyway, the scripts just grab data out of mysql then put it back so they don't have to return values to the caller. Yet

Thanks
Konan
QUOTE Thanks

Post Reply New Thread Subscribe


« Learning C++ with Xcode | Subversion question »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting 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 Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
need help to amend a script so that it only runs if iTunes is running nick_harambee OS X - Operating System 1 07-20-2009 12:15 PM
Script for adding users i_eat_short_ppl OS X - Operating System 0 06-04-2009 07:01 PM
How to use QuickSilver to run my script yinglcs OS X - Operating System 0 02-09-2009 09:54 PM
Really Need Help Regarding MAC Script MACSCRIPT OS X - Apps and Games 2 08-13-2008 08:15 AM
apple script to greet me off stand by jakeroberts OS X - Development and Darwin 0 04-29-2007 01:34 PM

All times are GMT -4. The time now is 05:04 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?