Is there any way to write strings to clipboard from SikuliX script?

Asked by masuo on 2018-05-19

I would like to send a message from SikuliX script to other processes via clipboard.

Windows10 + Java8 + SikuliX1.1.3(nightly Build)

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2018-05-19
Last query:
2018-05-19
Last reply:
2018-05-19
Mike (maestro+++) said : #1

SikuliX can write text into any control that accepts text. Then you can CTTRL-C and the text is in your clipboard. Then clear the control you used.

masuo (masuo-ohara) said : #2

Thank you @Mike for your comment.

But I want to write strings in the clipboard without writing to any GUI control.
In particular I want to send messages from SikuliX script to PowerShell script.

Best RaiMan (raimund-hocke) said : #3

as there is a getter:
http://sikulix-2014.readthedocs.io/en/latest/globals.html#App.getClipboard

there is also a setter: (another hidden feature ;-)
App.setClipboard(aString)

Be aware: the string should be UTF8 encoded if it should contain non-ASCII characters.

Interesting idea, to use the clipboard as "some pipe" ;-)

masuo (masuo-ohara) said : #4

Thanks RaiMan, that solved my question.