Sending keystrokes to background windows - inconsistent results.

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Kellware
Posts: 1
Joined: 30 Mar 2017, 18:14

Sending keystrokes to background windows - inconsistent results.

30 Mar 2017, 18:40

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


*************************************
Darayavahus
Posts: 36
Joined: 21 May 2016, 03:32

Re: Sending keystrokes to background windows - inconsistent results.

31 Mar 2017, 14:22

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.
Guest

Re: Sending keystrokes to background windows - inconsistent results.

01 Apr 2017, 22:46

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..
hitman
Posts: 21
Joined: 10 Aug 2014, 06:47

Re: Sending keystrokes to background windows - inconsistent results.

29 Aug 2017, 08:37

ControlSend,paneClassDC1,{F5},ahk_exe POWERPNT.EXE
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Sending keystrokes to background windows - inconsistent results.

29 Aug 2017, 12:02

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
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Rohwedder and 171 guests