# # Simple Google Docs robot # Author: Pawel Foremski <pjf@iitis.pl> # # 1. Create new Google Document, click on the content # 2. Arrange the windows so the browser window gets # focus when you click "Run" in Sikuli. # # STOP KEY: alt + shift + c # import random num_para = 20 # def hlight(): keyDown(Key.SHIFT + Key.HOME) keyUp() def style(num): keyDown(Key.CTRL + Key.ALT) type(num) keyUp() type(Key.END) def ctrl(key): keyDown(Key.CTRL) type(key) keyUp() type(Key.END) def linestop(): sleep(random.expovariate(2)) ### main for i in xrange(num_para): # type the title type("Hello, world!") hlight() style("1") type("\n") # type lorem ipsum type("Lorem ipsum dolor sit amet, id sale offendit sadipscing duo, ") linestop() type("nisl principes duo ex, harum movet aliquando eos ad. ") linestop() type("Ne mel sale omittantur. Delenit utroque complectitur mel at, ius detracto ") linestop() type("gloriatur deterruisset no, id mea posidonium scriptorem. Ius dicat constituto ") linestop() type("ad, an consul everti appetere qui. Verear molestiae ea eum, magna omnes placerat ius id.") type("\n\n") # type ending type("The End.") hlight() ctrl("b") type("\n\n") ctrl("b") sleep(random.expovariate(0.3))