Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -1,2 +1,17 @@
{{omit from|ACL2}}
{{omit from|Batch File}}
{{omit from|Brainf***}}
{{omit from|Maxima}}
{{Omit From|Modula-3}}
Send simulated keystrokes to a GUI window, or terminal. You should specify whether the target may be externally created (i.e., if the keystrokes are going to an application other than the application that is creating them).
{{omit from|PARI/GP}}
{{omit from|PHP}}
{{omit from|PostScript}}
{{omit from|R}}
{{omit from|Retro}}
{{omit from|TI-83 BASIC}} {{omit from|TI-89 BASIC}}
{{omit from|zkl}
Send simulated keystrokes to a GUI window, or terminal.
You should specify whether the target may be externally created
(i.e., if the keystrokes are going to an application
other than the application that is creating them).

View file

@ -0,0 +1,10 @@
>>> import pyautogui
>>> pyautogui.typewrite('Hello world!') # prints out "Hello world!" instantly
>>> pyautogui.typewrite('Hello world!', interval=0.25) # prints out "Hello world!" with a quarter second delay after each character
>>> pyautogui.press('enter') # press the Enter key
>>> pyautogui.press('f1') # press the F1 key
>>> pyautogui.press('left') # press the left arrow key
>>> pyautogui.keyDown('shift') # hold down the shift key
>>> pyautogui.press('left') # press the left arrow key
>>> pyautogui.keyUp('shift') # release the shift key
>>> pyautogui.hotkey('ctrl', 'shift', 'esc')

View file

@ -1,20 +1,26 @@
import java.awt.Robot
import java.awt.event.KeyEvent
/** Keystrokes when this function is executed will go to whatever application has focus at the time.
* Special cases may need to be made for certain symbols, but most of
* the VK values in KeyEvent map to the ASCII values of characters.
*/
object Keystrokes extends App {
def Keystroke(str: String) {
val robot = new Robot();
for (ch <- str.toCharArray()) {
def keystroke(str: String) {
val robot = new Robot()
for (ch <- str) {
if (Character.isUpperCase(ch)) {
robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(ch);
robot.keyRelease(ch);
robot.keyRelease(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_SHIFT)
robot.keyPress(ch)
robot.keyRelease(ch)
robot.keyRelease(KeyEvent.VK_SHIFT)
} else {
val upCh = Character.toUpperCase(ch);
robot.keyPress(upCh);
robot.keyRelease(upCh);
val upCh = Character.toUpperCase(ch)
robot.keyPress(upCh)
robot.keyRelease(upCh)
}
}
}
keystroke(args(0))
}