Ok here is part of the code that is causing the error:
char charlieReturn[10000];
charlieReturn[10000] = system("osascript /applications/jarvis/scripts/getTextCharlieResponce.scpt");
self.charlieOutput.stringValue = charlieReturn;
The getTextCharlieResponce.scpt returns something like this: “Hi my name is charlie” and maybe sometimes it will be longer than that. The script returns it plain text. I need help FAST!
Thanks in advance! 😀
Elijah
Unfortunately there are many problems in your code.
The
Cfunctionsystemdoes not return the standard output of the script aschar*.Even with a function which returns
char*, you can’t assign it to a array ofcharas you did:Cocoa’s string class,
NSString*, is not a C stringchar*, although you can easily convert between the two:If you want a string out of a call to an Apple script, you need to do the following:
Prepare an
NSAppleScript:Execute and get a reply:
Release the script:
Learn C & Objective-C and have fun!