Command prompt - right click will not open contextmenu

Asked by george munteanu

Hi,

I am trying to select + copy all text from a command prompt window.
If I use rightclick command then it returns some previously used text.

[1] My code is:
type (Key.ESC, KEY_CTRL)
paste (r"some text") # this will open a command prompt
wait(1)
rightClick("image1.png")

[2]Note:
I have tried:
- rightClick with at mouse point --> same behaviour (i.e "some text" is displayed)
- using "type" instead of "paste" --> same behaviour (i.e "some text" is displayed)
- If i right click manually --> same behaviour (i.e "some text" is displayed)
- type ALT + SPACE to open caption right menu - but the context menu is not displayed at all
In progress:
- clear clipboard via sikuli OR via python.

If you get the chance, please tell me what I am missing out.

take care

Question information

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

Not really sure, what you are trying to do.

--1. what Windows are we talking about?
on Windows 8 for example something like
type (Key.ESC, KEY_CTRL)
paste (r"Command P\n")

will open a new command window or switch to the already open one.

On Windows 7 this works similar, but I think it always opens a new prompt.

So now you have a command window.

And what are you doing then with rightClick?
Open the context menu, select all and copy it?

this works on Win8:
type(Key.ESC, KEY_CTRL)
wait(1)
type("Command P\n")
wait(3)
win = App.focusedWindow()

# use context menu
win.rightClick()
type(Key.DOWN)
type(Key.DOWN)
type(Key.DOWN)
type(Key.DOWN)
type(Key.ENTER)
type(Key.ENTER)

# or use the window menu
type(" ", Key.ALT)
type("e")
type(Key.RIGHT)
type(Key.DOWN)
type(Key.DOWN)
type(Key.DOWN)
type(Key.ENTER)
type(Key.ENTER)

after this, the command window content is on the clipboard.

Revision history for this message
george munteanu (georgetemenos) said :
#2

thanks a lot. that did the trick