select all text and copy to clipboard

Asked by Ben Dix

Hey Folks,

at the end of my script, my console output must be saved to a txt file.
right now I solved this by clicking on the top left of the java window, finding the buttons by images to do so.
The filename is generated by time and date stamps.
working, but takes a bit time...

I would prefer to do so by commands, not by image search...

I already tried to activate the java window and do type('a', Key.CTRL) to select all, but this action fails with the output:

[log] ( Ctrl ) TYPE "a"
[error] script [ Test_Enviroment ] stopped with error in line 66
[error] java.lang.IllegalArgumentException ( java.lang.IllegalArgumentException: Key: Not supported character: a )
[error] --- Traceback --- error source first
line: module ( function ) statement
66: main ( <module> ) type('a', Key.CTRL)
[error] --- Traceback --- end --------------

any advice how to use the select all shortcut inside the active java (output) window of my sikuli script?

thx for reading.

Question information

English Edit question
SikuliX Edit question
No assignee Edit question
Solved by:
Ben Dix
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :

Just tried on my macOS with 2.0.5: (thought you are on macOS, not Windows!?)

click() # make window foreground/active
type("a", Key.CMD) # select all text

having a text window centred on the screen.

The text is selected as expected.

Revision history for this message
Ben Dix (bendix80) said :

Hey RaiMan, thx for your reply.

I am on Mac AND Win 😄

It is working fine on Mac, looks like it is something about the java console in win.

Feels like the java output console is the problem...
is it possible, that the key shortcuts inside the java output console try to trigger the IDE ?

the log confirms, that the action happened, but maybe this command leads to nowhere...

[log] ( Ctrl ) TYPE "a"

would be great if anyone can test this on a win machine 😄
it is not a virtual machine, it is a physical win10 environment.

Revision history for this message
RaiMan (raimund-hocke) said :

ok ;-)

what is " java console"?

I can test on Windows also - no problem :-)

Revision history for this message
Ben Dix (bendix80) said :

I start sikuli by executing cmd command java -jar ...\sikulixide-2.0.5.jar -c
the cmd window , that stays in the background and that prints all my output is my so called java console 😄
sorry for my individual naming 😄

Revision history for this message
RaiMan (raimund-hocke) said :

indeed very individual :-)))

Revision history for this message
RaiMan (raimund-hocke) said :

Sorry, but I have to confirm, that the type() command does not work against a command line window.

You might pipe the complete java command output to a file (> mylog.txt) or use the print statement with the file option for the relevant information.

SikuliX's user log is also an option.

Revision history for this message
Ben Dix (bendix80) said :

thx RaiMan 😄 I can go on using the images to select all code of this window 😄