Results 1 to 3 of 3
  1. #1
    Call a script from Obj-c (or Xcode/Cocoa)

    Member Since
    Sep 10, 2008
    Posts
    61
    Call a script from Obj-c (or Xcode/Cocoa)
    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

  2. #2
    Call a script from Obj-c (or Xcode/Cocoa)
    xstep's Avatar
    Member Since
    Jun 25, 2005
    Location
    On the road
    Posts
    3,231
    Specs:
    2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
    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.

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

    Member Since
    Sep 10, 2008
    Posts
    61
    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Cocoa/Xcode/changing template
    By marshaboggs in forum OS X - Development and Darwin
    Replies: 0
    Last Post: 04-14-2009, 06:03 PM
  2. Problem with cocoa in xcode 3
    By osa in forum OS X - Development and Darwin
    Replies: 2
    Last Post: 07-03-2008, 03:06 AM
  3. stuck following cocoa / xcode tutorial
    By majik in forum OS X - Development and Darwin
    Replies: 1
    Last Post: 06-30-2008, 03:39 PM
  4. Switching but Cocoa/xcode help
    By mr..nemo in forum OS X - Development and Darwin
    Replies: 0
    Last Post: 04-26-2005, 06:05 AM
  5. Cocoa/Xcode
    By dim in forum OS X - Development and Darwin
    Replies: 1
    Last Post: 10-20-2004, 11:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •