Вот скрипт apple capsLockOff.scpt:
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.keyboard"
end tell
tell application "System Events"
tell application process "System Preferences"
get properties
click button "Modifier Keys…" of tab group 1 of window "Keyboard"
tell sheet 1 of window "Keyboard"
click pop up button 4
click menu item "No Action" of menu 1 of pop up button 4
delay 1
click button "OK"
end tell
end tell
end tell
tell application "System Preferences" to quit
Ниже приведен код какао для вызова вышеуказанного скрипта. Надеюсь, это поможет
-(void)runAppleScript{
NSString *fileName = @"capsLockOff";
NSString* path = [[NSBundle mainBundle] pathForResource:fileName ofType:@"scpt"];
NSURL* url = [NSURL fileURLWithPath:path];NSDictionary* errors = [NSDictionary dictionary];
NSAppleScript* appleScript = [[NSAppleScript alloc] initWithContentsOfURL:url error:&errors];
[appleScript executeAndReturnError:nil];
[appleScript release];
}