# # Simple Google Maps robot # Author: Pawel Foremski <pjf@iitis.pl> # # 1. Open the Google Maps in your web browser # 2. Switch to "maps" view (ie. not the satellite view) # 3. Make your browser window size to be approx. 1450 px / 1050 px # 4. Arrange the windows so the browser window gets focus when # you click "Run" in Sikuli. # # STOP KEY: alt + shift + c # import random # number of map moves num_moves = 100 # setup Sikuli Settings.MoveMouseDelay = 0.5 Settings.DelayAfterDrag = 0 Settings.DelayBeforeDrop = 0 # find google maps app b = find(Pattern().similar(0.40)) x = b.getX() y = b.getY() # go to Gliwice :) b.hover(Pattern().similar(0.45).targetOffset(38,-3)) for i in xrange(3): mouseDown(Button.LEFT) mouseUp() type("Gliwice, Poland\n") sleep(3) # loop for i in xrange(num_moves): loc_from = Location(x+random.randint(600,1300), y+random.randint(200,800)) loc_to = Location(random.randint(0,1600), random.randint(0,1200)) if (random.random() > 0.85): wheel(loc_from, random.choice([WHEEL_DOWN, WHEEL_UP]), 1) sleep(1.5) if (random.random() > 0.95): click(Location(x+1400, y+130)) sleep(0.5) mouseMove(Location(x+1200, y+130)) sleep(0.5) dragDrop(loc_from, loc_to) sleep(random.expovariate(5))