Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. NSAppleEventManager.shared().setEventHandler(self, andSelector: #selector(handleGetURLEvent(event:withReplyEvent:)), forEventClass: AEEventClass(kInternetEventClass), andEventID: AEEventID(kAEGetURL))
  2.  
  3. @objc func handleGetURLEvent(event: NSAppleEventDescriptor!, withReplyEvent: NSAppleEventDescriptor!) {
  4. if let text = event.paramDescriptor(forKeyword: AEKeyword(keyDirectObject)) {
  5. // you may want to filter the commands here
  6. if text.contains("yourScheme://doStuff") {
  7.  
  8. } else if ...
  9. }
  10. }
  11.  
  12. $ open "yourScheme://doStuff"
  13. $ open "yourScheme://doSomethingElse"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement