ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

AHK Newbie: SendInput to a particular process

(1/1)

mediaguycouk:
Hi all,
I've just written a very simple AHK script to load up VNC and then log into a PC, open IE, go to a website and login. The trouble is that if I click off the window it all breaks.

Is there a way of sending keys to a particular process (and if so how to find the process)? The process is started by AHK in the script.

Thanks

Graham

skwire:

--- Code: AutoIt ---Run, c:\path\to\my.exe, , , myPID ; myPID will have the started process' ID.
You can then try the ControlSend command for sending keys to a particular process.  Controlling a web browser in this manner can be an exercise in frustration, however.

mediaguycouk:
Thanks, that's the perfect command.

Do you see why this doesn't work?

--- ---#2::
Run, C:\Windows\System32\notepad.exe, , , notepad1pid
Run, C:\Windows\System32\notepad.exe, , , notepad2pid
Sleep, 500
ControlSend, notepad1pid, Hello Notepad 1
ControlSend, notepad2pid, Hello Notepad 2
return

skwire:

--- Code: AutoIt ---Run, C:\Windows\System32\notepad.exe, , , notepad1pidRun, C:\Windows\System32\notepad.exe, , , notepad2pidSleep, 500ControlSend, , Hello Notepad 1, ahk_pid %notepad1pid%ControlSend, , Hello Notepad 2, ahk_pid %notepad2pid%

Navigation

[0] Message Index

Go to full version