Search code examples
keyboardsikuli

How to send "Ctrl + c" in Sikuli?


This feels like it should be pretty easy but I can't find documentation on how to do this:

I just want Sikuli to type Ctrl+C to copy text to the clipboard.

type(KEY_CTRL+'c') doesn't work and neither does type(KEY_CTRL,'c').

Any suggestions?


Solution

  • Try using type("c",KEY_CTRL) instead.

    I wrote a simple script which types a line in notepad, double clicks it to mark it and then ctrl+x ctrl+v it into the document again. Works great.

    openApp("notepad.exe")
    
    find("textfield.png" )
    type("Some text")
    doubleClick("theText.png")
    
    type("x", KEY_CTRL)
    
    click("theTextField.png" )
    type("v",KEY_CTRL)