Here is the code:
- (IBAction) charlieImputText:(id)sender {
NSAppleScript *keystrokeReturn = [[NSAppleScript alloc] initWithSource:@"tell application \"System Events\" to keystroke return"];
[keystrokeReturn executeAndReturnError:nil];
[progressBarText startAnimation:self];
charlieImputSelf = [sender stringValue];
NSAppleScript *sendCharlieImput = [[NSAppleScript alloc] initWithSource:[NSString stringWithFormat:@"tell application \"Terminal\" to do shell script %@", charlieImputSelf]];
[sendCharlieImput executeAndReturnError:nil];
NSDictionary* errorDict;
NSAppleScript* script=[[NSAppleScript alloc]
initWithContentsOfURL:[NSURL fileURLWithPath:@"/applications/jarvis/scripts/getTextCharlieResponce.scpt" ]
error:&errorDict];
NSAppleEventDescriptor* desc=[script executeAndReturnError:&errorDict];
NSString* result=[desc stringValue];
self.charlieOutput.stringValue = result;
charlieOutput.textColor = [NSColor greenColor];
[script release];
[progressBarText stopAnimation:self];
}
Ok what this does is it sends what's ever in the text field to terminal and displays terminal's response on a text label. However, this does not work the way I want it to. It does not send the user input to terminal. Any ideas??
Thanks, Elijah