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

Asked by masuo

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:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
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.

Revision history for this message
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.

Revision history for this message
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" ;-)

Revision history for this message
masuo (masuo-ohara) said :
#4

Thanks RaiMan, that solved my question.