Checking shortcut keys for opening a tool window

Asked by Sreelekshmi

def shortcut():
    type(Key.CAPS_LOCK)
    type(Key.ALT+"m"+"a")
    wait(5)
    if exists(ToolWindow):
        print("shortcutkeys are working")
        return True
    else:
        return False

Can someone please help why its not working in Sikuli1.1.4

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:

This question was reopened

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

Key.CAPS_LOCK cannot be "typed"

 type(Key.ALT+"m"+"a")
is not valid either

 type("ma", Key.ALT)

or even

 keyDown(Key.ALT)
 type("ma")
KeyUp()

If you wanted uppercase m and a:

 keyDown(Key.ALT)
 type("MA")
 KeyUp()

Revision history for this message
Sreelekshmi (sree2604) said :
#2

 hover(AddChassis)
        keyDown(KeyModifier.ALT)
        type("ma")
        keyUp(KeyModifier.ALT)
        wait(3)
        assert search(AddChassisWindow),"AddChassisWindow is not found"
still not working , not sure . I am using 1.1.4 version

Revision history for this message
Sreelekshmi (sree2604) said :
#3

         hover(AddChassis)
        keyDown(KeyModifier.ALT)
        type("ma")
        keyUp(KeyModifier.ALT)
        wait(3)
        assert search(AddChassisWindow),"AddChassisWindow is not found"

still not working , not sure . I am using 1.1.4 version

Revision history for this message
Manfred Hampl (m-hampl) said :
#4

Are you sure that ALT still has to be pressed while typing "a"? Maybe you shoudl try

         keyDown(KeyModifier.ALT)
         type("m")
         keyUp(KeyModifier.ALT)
         type("a")
         wait(3)

Eventuelly you need a small delay between "m" and "a"

         keyDown(KeyModifier.ALT)
         type("m")
         wait(0.5)
         type("a")
         keyUp(KeyModifier.ALT)

We do not know what your program does and how that is implemented. You have to test a bit yourself.

And - by the way - "still not working" does not provide any insight to us. What happens if you try? Does a wrong window open, or does it type the chararcters to a wrong window, or does absolutely nothing visible on screen, or ...?

Can you help with this problem?

Provide an answer of your own, or ask Sreelekshmi for more information if necessary.

To post a message you must log in.