← Back to team overview

sikuli-driver team mailing list archive

[Question #663641]: Global keys not working properly on script

 

New question #663641 on Sikuli:
https://answers.launchpad.net/sikuli/+question/663641

I am using below codes to call def() event via sikuliX but while running this event, I click excel macro button to call it's script and even though script also running but it skips to click on "Chrome.png".

SikuliX Codes:
def Primary(event):
    find()
    click(Pattern().targetOffset(61,2))
    type("g",KEY_CTRL)
    type(Key.BACKSPACE)
    type("H36" + Key.ENTER)
    type(Key.LEFT)
    type("c",KEY_CTRL)
    find(Chrome.png)
    click(Chrome.png)  # <------------------------------------------------------------Skip on this line 
    while not exists():
        type(Key.PAGE_UP*3)
    click()
    click(Pattern().targetOffset(-83,5))
    type("v",KEY_CTRL)
    type(Key.TAB + Key.ENTER)
    find()
    click() 
    type("g",KEY_CTRL)
    type(Key.BACKSPACE)
    type("H46" + Key.ENTER)
    type(Key.LEFT)
    type("c",KEY_CTRL)
    find()
    click(Chrome.png) # <--Switch
    click(Chrome.png)
    type("a",KEY_CTRL)
    type(Key.BACKSPACE)
    type("v",KEY_CTRL)
    find()
    click() # <--Switch
    type("g",KEY_CTRL)
    type(Key.BACKSPACE)
    type("H51" + Key.ENTER)
    type(Key.LEFT)
    type("c",KEY_CTRL)
    find(Chrome.png)
    click(Chrome.png) # <--Switch
    if exists():
        click()
        type("v",KEY_CTRL)
        type(Key.TAB*11)
        #type(Key.PAGE_DOWN)
        #click("1514380908917.png")
        type(Key.DOWN*40)
        type(Key.UP*17)
        type(Key.TAB)
        wait(1)
        type("a",KEY_CTRL)
        type(Key.BACKSPACE)
    else:
        click()
        type("a",KEY_CTRL)
        type(Key.BACKSPACE)
        type("v",KEY_CTRL)
        type(Key.PAGE_DOWN)
        wait(1)
        click()
        type(Key.DOWN*40)
        type(Key.UP*17)
        type(Key.TAB)
        wait(1)
        type("a",KEY_CTRL)
        type(Key.BACKSPACE)
    popup("Click has done!")
Env.addHotkey("n", KeyModifier.CTRL + KeyModifier.ALT , Primary)
while True:
    wait(1)


Excel VB:
Private Declare Sub Sleep Lib "Kernel32" (ByVal ms As Long)
Sub Button1_Click()
    SendKeys "^%n"
    Sleep 5000
End Sub

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.