← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #662682]: Facing some hiccups when running skl script from excel VBA

 

Question #662682 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/662682

    Status: Open => Answered

masuo proposed the following answer:
@RaiMan suggested hotkey as a solution in Question #662319.
https://answers.launchpad.net/sikuli/+question/662319

Find out a short cut key not used in EXCEL.  
Define hotkey handler function that will be called by the short cut key,in the SikuliX script.
This script needs to wait forever for input. In other words this script must not be terminated. 

Run SikuliX script before running EXCEL VBA.
Then send the short cut key in EXCEL VBA.

[example codes]
This codes shown here is only an idea, not complete.
#-----
def script01:
    popup("script01")

def script02:
    popup("script02")

#-----read linkage file between EXCEL VBA and SikuliX script
def read_info():
    info = []
    f = open('C:\tmp\info.txt', 'r')
    # append to "info" from file 
    f.close()
    return info

#-----hotkey handler
def hotley_handler(event):
    info = read_info()
    # branch to script01 or script02 by info 
    
#-----Main script
Env.addHotkey("m", KeyModifier.CTRL, hotley_handler)
popup("Click [OK] to exit")

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