Page 1 of 1

Sending keystrokes to background windows - inconsistent results.

Posted: 30 Mar 2017, 18:40
by Kellware
I'm needing to control a presentation ( acrobat or power-point) in the background.

My code works to the extent it will get its keystrokes to NOTEPAD while its in the background,
but NOT acrobat or powerpoint.

If acrobat is foreground, the code works - acrobat gets its key strokes, notepad (in the background gets it keystrokes)
( im just using notepad as a way to check the code it live and reaching somethings in the background)

The following code is what I'm using at present. WOULD greatly appreciate any tips on whats going on.
Its a win7 laptop.

thanks


********************************
#InstallKeybdHook

#UseHook



^g::
controlsend, ,{PgDn},ahk_exe AcroRd32.exe
controlsend, ,A string triggered by pressing g ,ahk_exe Notepad.exe
return

^h::
controlsend, ,{PgUp},ahk_exe AcroRd32.exe
controlsend, ,A string triggered by pressing h,ahk_exe Notepad.exe
return


*************************************

Re: Sending keystrokes to background windows - inconsistent results.

Posted: 31 Mar 2017, 14:22
by Darayavahus
Have you tried sending keystrokes to process ID?

Winget, ID, ID, A
ControlSend,,{PgDn},AHK_ID %ID%

It works flawlessly for me when handling Kitty.exe in background on Win7 OS.

Re: Sending keystrokes to background windows - inconsistent results.

Posted: 01 Apr 2017, 22:46
by Guest
Thanks for the tip, I have tried process ID, as reported by windows spy,

and same result..
I will try and capture the ID as per your example,

thanks..

Re: Sending keystrokes to background windows - inconsistent results.

Posted: 29 Aug 2017, 08:37
by hitman
ControlSend,paneClassDC1,{F5},ahk_exe POWERPNT.EXE

Re: Sending keystrokes to background windows - inconsistent results.

Posted: 29 Aug 2017, 12:02
by jeeswg
This works for me to send PgUp to Adobe Reader, whether it is the active window or not.

Code: Select all

q::
ControlSend, AVL_AVView20, {PgUp}, ahk_class AcrobatSDIWindow
return