type

type(text, [modifiers])

type text at the current location or current focused input field

Sikuli

All Sikuli commands are run through the vision command from within TagUI.

Command Usage

  1. You can type a string of text.
  2. vision type('this string of text will be typed at the current location')
  3. You can type a keystroke e.g. Alt-F, followed by P - to display the print option for most windows application.
  4. vision type('f',Key.ALT)
    wait 1
    vision type('p')
    
    • Line 1: Type Alt-F
    • Line 2: wait command to wait for 1 second - this is to wait for the File menu to appear. If you find that the menu takes a bit longer to display, you may want to increase this to 2 or 3 seconds.
    • Line 3: press the 'p' key to display the Print option. (/)
  5. The following codes can be used to highlight and clear an input field:
  6. vision type('a', Key.CTRL)
    vision type(Key.BACKSPACE)
    
    • Line 1: Type CTRL-A to highlight the whole field.
    • Line 2: Type Backspace to clear the field.
  7. Strings are concatenated or joined using "+"
  8. vision type("some text" + Key.TAB + "more text" + Key.TAB + Key.ENTER)

    You also type the above using:

    vision type("some text\tmore text\n")
  9. The following press the Down arrow key 3 times
  10. vision type(Key.DOWN)
    vision type(Key.DOWN)
    vision type(Key.DOWN)
    

    If you find that the speed is too fast, you can use the wait command too add in some delay. In this case, we add in a 1 second delay:

    vision type(Key.Down)
    wait 1
    vision type(Key.Down)
    wait 1
    vision type(Key.Down)
    
  11. If you need to press the Up, Right and Left keys, it's:
  12. vision type(Key.UP)
    vision type(Key.RIGHT)
    vision type(Key.LEFT)
    
  13. You can press Ctrl-End to scroll to the end of a web page:
  14. vision type(Key.END, Key.CTRL)
  15. You can press Ctrl-F4 to close a windows application:
  16. vision type(Key.F4, Key.CTRL)
  17. You can press F3 to search for a string in browser:
  18. vision type(Key.F3)

Other Keys

  • Modifier Keys
  • Key.ALT
    Key.CMD
    Key.CTRL
    Key.META
    Key.SHIFT
    Key.WIN
    
  • Miscellaneous Keys
  • Key.BACKSPACE
    Key.DELETE
    Key.ENTER
    Key.ESC
    Key.INSERT
    Key.SPACE
    Key.TAB
    
  • Function Keys
  • Key.F1
    Key.F2
    Key.F3
    Key.F4
    Key.F5
    Key.F6
    Key.F7
    Key.F8
    Key.F9
    Key.F10
    Key.F11
    Key.F12
    Key.F13
    Key.F14
    Key.F15
    
  • Navigation Keys
  • Key.LEFT
    Key.RIGHT
    Key.UP
    Key.DOWN
    Key.PAGE_UP
    Key.PAGE_DOWN
    Key.HOME
    Key.END
    

Comments (0)

There are no comments posted here yet

Leave your comments

Posting comment as a guest. Sign up or login to your account.
Attachments (0 / 3)
Share Your Location