[阅读: 358] 2010-07-20 02:42:23
下面这个程序是python操作shell来sendkey的例子,具体的你再查一下MSDN,2003肯定是可以的
import win32api
import win32com.client
shell = win32com.client.Dispatch("WScript.Shell")
shell.Run("notepad")
win32api.Sleep(100)
shell.AppActivate("notpad")
#win32api.Sleep(100)
shell.SendKeys("1{+}")
#win32api.Sleep(500)
shell.SendKeys("2")
#win32api.Sleep(500)
shell.SendKeys("~") # ~ is the same as {ENTER}
#win32api.Sleep(500)
shell.SendKeys("*3")
#win32api.Sleep(500)
shell.SendKeys("~")
#win32api.Sleep(2500)
shell.SendKeys("^ ")
win32api.Sleep(500)
shell.SendKeys("a")
shell.SendKeys(" ")
shell.SendKeys("s")
shell.SendKeys("b")
shell.SendKeys("2")
shell.SendKeys(" ")
欢迎访问新版:
我读书我存在
www.freecoder.org/~phil
我爱大锁头啊!我爱大锁头!!!!