Added a multi_screen.py script.

This commit is contained in:
Cory Walker 2011-07-01 17:14:38 -04:00
parent 41dc1a0f7b
commit ee99430c90
3 changed files with 45 additions and 2 deletions

39
examples/multi_screen.py Normal file
View File

@ -0,0 +1,39 @@
from x11_automate import *
from time import sleep
from subprocess import Popen, PIPE
delay = 0.7
# Start amdccle
c = 'gksudo amdcccle &'
Popen(c, stdout=PIPE, shell=True)
sleep(4)
ccc = search(name="Catalyst Control Center", onlyvisible=True)[0]
ccc.move(0, 0)
ccc.activate()
sleep(delay)
click_at(84, 184)
sleep(delay)
click_at(655, 412)
sleep(delay)
click_at(775, 505)
sleep(delay + 1)
click_at(580, 147)
sleep(delay)
mouse_move(600, 193)
sleep(delay)
mouse_move(693, 216)
sleep(delay)
click_at(835, 283)
sleep(delay)
click_at(177, 573)
sleep(4)
dn = search(name="Display Notification", onlyvisible=True)[0]
dn.move(0, 0)
dn.activate()
sleep(delay)
click_at(210, 147)

View File

@ -101,9 +101,13 @@ def click(btn):
c = "click %d" % btn
return run_command(c)
def click_at(x, y, btn):
def click_at(x, y, btn=1):
mouse_move(x, y)
return click(btn)
def run_command(c):
return Popen("xdotool " + c, stdout=PIPE, shell=True).stdout.read()
return run_command_raw("xdotool " + c)
def run_command_raw(c):
return Popen(c, stdout=PIPE, shell=True).stdout.read()