keeweb/helper/darwin/KeeWebHelper/KeeWebHelper/main.swift

20 lines
520 B
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Foundation
let src = CGEventSourceCreate(CGEventSourceStateID.HIDSystemState)
func pressChar(char: UniChar) {
pressCharUpDown(char, down: true)
pressCharUpDown(char, down: false)
}
func pressCharUpDown(char: UniChar, down: Bool) {
var ch = char;
let keyEvent = CGEventCreateKeyboardEvent(src, 0, down)
CGEventKeyboardSetUnicodeString(keyEvent, 1, &ch)
CGEventPost(CGEventTapLocation.CGHIDEventTap, keyEvent)
}
for char in "\n^A~A´A¼Î©~{*!+¢f4ыâ\n".utf16 {
pressChar(char)
}