#!/usr/bin/python from dogtail.procedural import * from dogtail.utils import * from dogtail import tree # TODO - put code here to erase Foo.odt files from previous runs #start up OpenOffice Writer # # Note : Dogtail will only work on GTK-enabled versions of OpenOffice # run("oowriter",5) focus.frame('Untitled1 - OpenOffice.org Writer') oowriter = tree.root.application('soffice') #Because there is no object with a .text properites that corresponds to the doc, text entry is done with basic keyCombo's keyCombo("F") keyCombo("o") keyCombo("o") #Get the File and File>Save menu Items menuFile = oowriter.menu('File') menuItemSave = menuFile.menuItem('Save') #Because the menuItems are not clickable, use select + Enter to activate them menuFile.select(); keyCombo('Return'); menuItemSave.select(); keyCombo('Return'); #Save the file dialogSave = oowriter.dialog('Save') dialogSave.child(roleName = "text").text = "Foo" buttonSave = dialogSave.child('Save', roleName = "push button") print buttonSave.actions.keys() buttonSave.click() #Quit the app menuItemExit = menuFile.menuItem('Exit') menuFile.select(); keyCombo('Return'); menuItemExit.select(); keyCombo('Return');