View Single Post
  #51  
Old 13.09.2011, 13:43
randomthing
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by drbits View Post
Code:
while (`ps -e | grep "java.*"') {
    if (`ps -e --windowtitle | grep "*.?\Please Enter"') beep 700 2
    sleep 2
    }
Code:
#!/usr/bin/python

from Xlib import display, X
import re
import time 
import os

display = display.Display()
while 1:

    win_list = display.screen().root.query_tree().children
    for win in win_list:
        try:
            name = win.get_wm_name()
            if name is not None and name.find("Please enter") >= 0:
                os.system("aplay /myspecialpath/sounds/error.wav")
        except Exception as e:
            print e
    print 
    time.sleep(5)
Works nicely for me on linux.
Reply With Quote