Skip to content

@laclefyoshi /keyboard.py
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
controlling keyboard with Jython
#!/usr/bin/jython
# -*- coding: utf-8 -*-
# Copyright : (c) SAEKI Yoshiyasu
# License : MIT-style license
# <http://www.opensource.org/licenses/mit-license.php>
# last updated: 2011/06/25
from java.awt import Robot
from java.awt.event import KeyEvent
import os
os.system("""
osascript << EOF
tell application "TextEdit"
activate
end tell
EOF
""")
# == os.system("open /Applications/TextEdit.app")
rbt = Robot()
rbt.keyPress(KeyEvent.VK_SHIFT)
rbt.keyPress(KeyEvent.VK_H)
rbt.keyRelease(KeyEvent.VK_H)
rbt.keyRelease(KeyEvent.VK_SHIFT)
rbt.keyPress(KeyEvent.VK_E)
rbt.keyRelease(KeyEvent.VK_E)
rbt.keyPress(KeyEvent.VK_L)
rbt.keyRelease(KeyEvent.VK_L)
rbt.keyPress(KeyEvent.VK_L)
rbt.keyRelease(KeyEvent.VK_L)
rbt.keyPress(KeyEvent.VK_O)
rbt.keyRelease(KeyEvent.VK_O)
rbt.keyPress(KeyEvent.VK_PERIOD)
rbt.keyRelease(KeyEvent.VK_PERIOD)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.