nsapplescript

Sandbox entitlement to script iTunes via NSAppleScript

荒凉一梦 提交于 2019-12-11 12:03:30
问题 I'm trying to script iTunes from NSAppleScript in my Cocoa app in order to add a file to the library. In my entitlements file, I added the following: <key>com.apple.security.scripting-targets</key> <dict> <key>com.apple.itunes</key> <array> <string>com.apple.itunes.library.read-write</string> </array> </dict> I then call the AppleScript like this: var error: NSDictionary? = nil let appleScript = NSAppleScript(source: "tell application \"iTunes\" to add (POSIX file \"\(path)\") to library

My applescript doesn't work any more when I upgrade my OS X to 10.9

前提是你 提交于 2019-12-01 03:30:11
问题 The following code is trying to open the proxies settings dialog, NSAppleScript *a = [[NSAppleScript alloc] initWithSource:@"tell application \"System Preferences\"\nset current pane to pane \"com.apple.preference.network\"\nactivate\nend tell\ntell application \"System Events\" to tell process \"System Preferences\" to tell window 1\n click button -3\nclick radio button -2 of tab group 1 of sheet 1\nend tell"]; [a executeAndReturnError:nil]; it has been working well until I upgrade my Mac OS