Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NSAppleEventManager.shared().setEventHandler(self, andSelector: #selector(handleGetURLEvent(event:withReplyEvent:)), forEventClass: AEEventClass(kInternetEventClass), andEventID: AEEventID(kAEGetURL))
- @objc func handleGetURLEvent(event: NSAppleEventDescriptor!, withReplyEvent: NSAppleEventDescriptor!) {
- if let text = event.paramDescriptor(forKeyword: AEKeyword(keyDirectObject)) {
- // you may want to filter the commands here
- if text.contains("yourScheme://doStuff") {
- } else if ...
- }
- }
- $ open "yourScheme://doStuff"
- $ open "yourScheme://doSomethingElse"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement