Posted: Mon Jan 20, 2014 2:31 am Post subject: trouble sending keystrokes in python
I know actually injecting keystrokes with python is difficult but the script below should still send keys to the window; instead its not focusing its input to the window specified and still sends the keys to the window im viewing.
Code:
import win32com
import time
import win32com.client
import subprocess
I don't see why the title of the window would be "notepad.txt" instead of "Untitled - Notepad" or something. It is probably better to use the PID as the argument to AppActivate.
edit: it seems that the WScript AppActivate, unlike the VB one, can't take a PID as a parameter (http://msdn.microsoft.com/en-us/library/wzcddbek%28v=vs.84%29.aspx). But it looks like you can just use "Notepad" and it will match, regardless of which file (if any) is open.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum