I couldn't find specific examples of using the SendKeys method of Windows Script Host (WSH) from Python and win32com, so I converted some of the example scripts at MSDN from VBScript to Python. Hopefully, this will make conversion of some of your own scripts easier and allow you to write straight .py code rather than resorting to using .pys scripts. ka --- Kevin Altis [EMAIL PROTECTED] --- 1st example # Python version of MSDN example for SendKeys # uses the Windows calculator and sends keystrokes to execute a simple calculation # http://msdn.microsoft.com/scripting/default.htm?/scripting/windowshost/doc/w sMthSendKeys.htm # the above URL also documents the codes to use with SendKeys import win32api import win32com.client shell = win32com.client.Dispatch("WScript.Shell") shell.Run("calc") win32api.Sleep(100) shell.AppActivate("Calculator") 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) --- 2nd example # various Windows Script Host (WSH) examples converted to Python # converted from # http://msdn.microsoft.com/scripting/default.htm?/scripting/windowshost/doc/w sMthRun.htm # http://msdn.microsoft.com/scripting/windowshost/doc/wsproenvironment.htm # http://msdn.microsoft.com/scripting/default.htm?/scripting/windowshost/doc/w sMthSendKeys.htm # main page is at http://msdn.microsoft.com/scripting/ import sys import win32api import win32com.client shell = win32com.client.Dispatch("WScript.Shell") # launch Notepad to edit this script, simple version # sys.argv[0] is WScript.ScriptFullName in WSH #shell.Run("notepad " + sys.argv[0]) # this time set the window type, wait for Notepad to be shut down by the user, # and save the error code returned from Notepad when it is shut down # before proceeding ret = shell.Run("notepad " + sys.argv[0], 1, 1) print ret # open a command window, change to the path to C:\ , # and execute the DIR command shell.Run("cmd /K CD C:\ & Dir") # environment strings print shell.ExpandEnvironmentStrings("%windir%") _______________________________________________ ActivePython mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/activepython