Rev 1 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1 | Rev 5 | ||
---|---|---|---|
Line 139... | Line 139... | ||
139 | 139 | ||
140 | private func runAppleScript(_ scriptText: String) { |
140 | private func runAppleScript(_ scriptText: String) { |
141 | let script = NSAppleScript(source: scriptText)! |
141 | let script = NSAppleScript(source: scriptText)! |
142 | var error: NSDictionary? = nil |
142 | var error: NSDictionary? = nil |
143 | let resultMaybe = script.executeAndReturnError(&error) as NSAppleEventDescriptor? |
143 | let resultMaybe = script.executeAndReturnError(&error) as NSAppleEventDescriptor? |
144 |
|
144 | if (resultMaybe == nil) |
145 | { |
145 | { |
- | 146 | let myStringDict = error as? [String:AnyObject] |
|
- | 147 | if (myStringDict?["NSAppleScriptErrorNumber"] as! Int16 == 1002) { |
|
- | 148 | let alert = NSAlert() |
|
- | 149 | alert.addButton(withTitle: "OK".localized) |
|
- | 150 | alert.messageText = "system_message".localized + "\n" + (myStringDict?["NSAppleScriptErrorBriefMessage"] as! String) |
|
- | 151 | alert.informativeText = "allow_perms".localized |
|
- | 152 | alert.alertStyle = .warning |
|
- | 153 | alert.runModal() |
|
- | 154 | } |
|
146 | print (error as Any) |
155 | print (error as Any) |
147 | return |
156 | return |
148 | } |
157 | } |
149 | } |
158 | } |
150 | 159 |