Issues with keystrokes in Windows Server 2012 R2

Get help with using AutoHotkey and its commands and hotkeys
User avatar
Posts: 43
Joined: 08 Jan 2014, 19:04

Issues with keystrokes in Windows Server 2012 R2

26 Feb 2015, 19:38

I have recently had to switch to using Windows 2012 R2. I have a (huge) AHK script I have been building for years. It works on Windows 7 as well as Windows Server 2008 R2. I have never had a chance to test it on Windows 8, though. Now, under Windows 2012, I am noticing that it very often is ignoring the key strokes I have defined, but only within "some" windows/applications. In some apps, the keys work, while other they do not.

I am still trying to track down what doesn't work in which particular apps, but I wanted to ask the community if anyone else has noticed this behavior, too. Is this a known issue?

I will try to setup a simple test example to prove (or disprove) that it is indeed caused by Windows 2012.

Thank you...

Mike V.
User avatar
Posts: 658
Joined: 30 Sep 2013, 10:54
Location: Brazil

Re: Issues with keystrokes in Windows Server 2012 R2

26 Feb 2015, 20:17

Hello Mike.

Welcome to the AutoHotkey community forums :angel:

If only some keys are getting ignored, try limiting the speed at wich the keystrokes are sent to the target window using SetKeyDelay. If a window is ignoring ANY keystrokes, try SendInput instead of Send.

AHK Docs on Send wrote:Send may have no effect on Windows Vista or later if the active window is running with administrative privileges and the script is not. This is due to a security mechanism called User Interface Privilege Isolation.
Best wishes :thumbup:
User avatar
Posts: 88
Joined: 14 Apr 2014, 03:20

Re: Issues with keystrokes in Windows Server 2012 R2

27 Feb 2015, 22:43

Hey Mike,

My guess would be that the particular apps you're talking about are ones with administrator privileges. This became an issue for me also when I switched to windows 8. To test, open 2 windows, one a regular cmd.exe, and the other a cmd.exe with administrator privileges. See if your hotkeys work in the regular one and not in the admin one. I'm not sure why this wasn't an issue for me in windows 7; perhaps it was because I used an admin account.

The only way to get around this that I know of is to run your AutoHotkey scripts as an administrator. You can set this to be the default by going to AutoHotkey.exe > Properties > Compatibility tab > Run as administrator. However, I decided not to go this route because then all programs I launched with AutoHotkey were also launched with admin privileges and also asked for a UAC prompt. So I just don't use hotkeys with admin applications.

If you need to do it from inside AutoHotkey here's the code I've been using:

Code: Select all

DllCall("shell32\ShellExecuteA", uint, 0, str, "RunAs", str, "insert path here", str, "insert arguments here", str, A_WorkingDir, int, 1)
I'm not exactly sure how it works, I just copied it form somewhere. Search the forums for "ShellExecuteA" for more info.

Return to “Ask For Help”

Who is online

Users browsing this forum: AHKStudent, Albireo, EmmaEmily, Google [Bot], huangjunwei, Jaay_B, LiangShuii, Sid4G, sikongshan, yjs778 and 222 guests