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

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

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

click() # make window foreground/active
wait(1)
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 :
#2

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 :
#3

ok ;-)

what is " java console"?

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

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

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 :
#5

indeed very individual :-)))

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

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 :
#7

thx RaiMan ๐Ÿ˜„ I can go on using the images to select all code of this window ๐Ÿ˜„