Keyboard shortcut not working as expected

Asked by Test

Hey there,

I'm trying to minimize a command prompt window by using a keyboard shortcut (Alt + Space + N) but it's not working as intended. My code is as follows:

switchApp("cmd.exe")
type("n" + Key.SPACE, KeyModifier.ALT)

My log shows:

[log] App.focus cmd.exe(0) #0
[log] ( Alt ) TYPE " n"

It shows that there is a space before the n, but I don't want that, I want to execute the full keyboard shortcut. How can I do this?

Thanks.

EDIT: After some experimentation I managed to find a solution:

switchApp("cmd.exe")
type(Key.SPACE, KeyModifier.ALT)
type('n')

That works well and good.

comment from RaiMan:
... and that is exactly as it should be done, because with the wrong version the alt key is held down with the space AND the n and this is another key sequence as needed.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Test
Solved:
Last query:
Last reply:
Revision history for this message
Test (c4456517) said :
#1

Problem solved.