2013-04-11 01:07:29 -07:00
|
|
|
(import java.awt.Robot)
|
2020-02-17 23:21:07 -08:00
|
|
|
(import java.awt.event.KeyEvent)
|
2013-04-11 01:07:29 -07:00
|
|
|
(defn keytype [str]
|
|
|
|
|
(let [robot (new Robot)]
|
|
|
|
|
(doseq [ch str]
|
|
|
|
|
(if (Character/isUpperCase ch)
|
|
|
|
|
(doto robot
|
|
|
|
|
(.keyPress (. KeyEvent VK_SHIFT))
|
|
|
|
|
(.keyPress (int ch))
|
|
|
|
|
(.keyRelease (int ch))
|
|
|
|
|
(.keyRelease (. KeyEvent VK_SHIFT)))
|
|
|
|
|
(let [upCh (Character/toUpperCase ch)]
|
|
|
|
|
(doto robot
|
|
|
|
|
(.keyPress (int upCh))
|
|
|
|
|
(.keyRelease (int upCh))))))))
|