Text Field -> Shell Script?

Discussion in 'iOS Development' started by H4CK!NT0SH, Jul 10, 2009.

  1. H4CK!NT0SH

    H4CK!NT0SH Banned

    Joined:
    Jun 28, 2009
    Messages:
    159
    Likes Received:
    0
    Device:
    2G iPod touch
    Hey. I'm trying to figure out what code would be written if I wanted to have it so whatever is entered in a certain text field on an application (Mac, not iPhone,) then that text would be used in a shell script, or an apple script. Anyone know? Thanks.
  2. Tyr0

    Tyr0 New Member

    Joined:
    Dec 17, 2007
    Messages:
    533
    Likes Received:
    6
    Device:
    iPhone 3GS (White)
    Could you do something like (quick summary)?

    Code:
    NSString *script = [textField text];
    
    NSString *scriptPath = [[NSBundle mainBundle] pathForResource:@"ShellScript" ofType:"sh"];
    
    [script writeToFile:scriptPath atomically:YES];
    
    system("%@" scriptPath);
    

Share This Page