我有一个函数发送字符串“theData”。我想在此代码中插入该字符串。请有人告诉我这个正确的语法?事情变得有点多毛了。谢谢!如何将一些数据插入到AppleScript字符串中
NSTask *task;
task = [[NSTask alloc] init];
[task setLaunchPath:@"/usr/bin/osascript"];
[task setArguments:[NSArray arrayWithObjects:@"-e", @"tell application \"System Events\"\n",
@"-e", @" keystroke \"" + theData + "\"",
@"-e", @"end tell", nil]];
[task launch];
可能有更好的方法来模拟Objective-C的击键... – icktoofay 2010-07-02 02:53:13
而事实上,它看起来像是存在的。 (http://stackoverflow.com/questions/2379867/) – icktoofay 2010-07-02 02:56:30
哇。多谢,伙计。 – 2010-07-02 02:58:19