← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #678851]: XLSX Handling in Sikuli

 

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

Mike posted a new comment:
New versions of Excel have enhanced keyboard control. You press ALT and
it reveals loads of opportunities.

Below is Office 365 on Windows 10.

#Create an xlsx copy of an xls spreadsheet

def xls2xlsx(xls):

   wdelay = 2
    switchApp("excel")
    wait(wdelay)
    type(Key.ALT) #activate alt keys
    wait(wdelay)
    type("f") # "File"
    wait(wdelay)
    type("o") # "Open"
    wait(wdelay)
    type("o") # "Browse"
    wait(wdelay)
    print "About to print " + xls
    type(xls)
    wait(wdelay)
    type(Key.ENTER) # Should bring up spreadsheet
    wait(wdelay)
    type(Key.ALT) #activate alt keys
    wait(wdelay)
    type("f") # "File"
    wait(wdelay)
    type("a") # "Save As"
    wait(wdelay)
    type("y4") # File Type
    wait(wdelay)
    type(Key.UP) #Select xlsx entry
    type(Key.UP)
    type(Key.UP)
    wait(wdelay)
    type(Key.ENTER)
    wait(wdelay)
    type(Key.ALT) #R    Reactivate Alt keys
    wait(wdelay) 
    type("a")
    wait(wdelay)
    type("y5") #press save button
    wait(wdelay)
    type(Key.ALT) # Now close sheet
    wait(wdelay) 
    type("f")
    wait(wdelay)
    type("c") 

xlsheet = "ExcelTest"
xls2xlsx(xlsheet)


(Note this is an example of using a visual interface but not needing any
computer vision to do so)

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