This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Safari" | |
repeat with tabItem in tabs of window 1 | |
set link to URL of tabItem | |
tell application id "cc.anybox.Anybox" | |
save link | |
end tell | |
end repeat | |
end tell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 0x08 is key code for "c" | |
guard let keydownEvent = CGEvent(keyboardEventSource: nil, virtualKey: 0x08, keyDown: true) else { return } | |
guard let keyupEvent = CGEvent(keyboardEventSource: nil, virtualKey: 0x08, keyDown: false) else { return } | |
keydownEvent.flags = CGEventFlags.maskCommand | |
keydownEvent.post(tap: CGEventTapLocation.cghidEventTap) | |
keyupEvent.flags = CGEventFlags.maskCommand; | |
keyupEvent.post(tap: CGEventTapLocation.cghidEventTap) | |
// For it to work, Accessibility needs to be enabled in |