sendKey

Kam-Hung Soh kamhung.soh at gmail.com
Mon Jun 9 01:52:18 CEST 2008


Gandalf wrote:
> I found some script that send keys , But I couldn't  manage to send
> CTRL+c with none of them
> 
> can any one tell me what i'm doing wrong:
> 
> import win32api
> import win32com.client
> 
> shell = win32com.client.Dispatch("WScript.Shell")
> shell.Run("Notepad")
> win32api.Sleep(100)
> shell.AppActivate("Notepad")
> win32api.Sleep(100)
> shell.SendKeys("112435435")
> win32api.Sleep(100)
> 
> shell.SendKeys("^a") # that wouldn't select all
> win32api.Sleep(100)
> shell.SendKeys("^c")# that wouldn't copy

Works for me, using Vista and ActiveState Python 2.5.1.1.

> import SendKeys
> SendKeys.SendKeys("""^c""")
> 
> 
> Thank you!

-- 
Kam-Hung Soh <a href="http://kamhungsoh.com/blog">Software Salariman</a>




More information about the Python-list mailing list