#!/usr/bin/python from dogtail.procedural import * from dogtail.utils import * from dogtail import tree import os import re import time # 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') #Click the File menu item using rawClick menuFile.rawClick() #give the menu some time to display time.sleep(2) #Click the Save menu item using xte os.system ("xte 'mousemove " + str(menuItemSave.position[0]) + " " + str(menuItemSave.position[1]) + "'") os.system ("xte 'mouseclick 1'") #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');