Windows 7 – Auto Run Snipping Tool with AutoHotKey

autohotkeyautomationsnippingwindows 7

I am trying to get Windows 7 sniping tool to run when I hit my PRINTSCREEN keyboard button with AUTOHOTKEY.

I have been unsuccessful so far though. Here is what I have for the AutoHotKey script.

I have tried this

PRINTSCREEN::Run, c:\windows\system32\SnippingTool.exe

and this

PRINTSCREEN::Run, SnippingTool.exe

and this

PRINTSCREEN::Run, SnippingTool

And all those give me an error that basically says it cannot find the file, however the file path seems to be correct, I can copy paste it into a window and it opens the snipping tool, any ideas why it will not work?


Here is the full code to my AHK file…

;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win7
; Author:         Jason Davis <friendproject@>
;
; Script Function:
; Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.


/*
PRINTSCREEN = Will run Windows 7 snipping tool
*/
PRINTSCREEN::Run, c:\windows\system32\SnippingTool.exe
return

Best Answer

Are you running a 64-bit version of Windows 7 by any chance?

Windows 7 (as well as Vista I believe) implements what is called WoW64 Filesystem Redirection. If this is the case, you'll want to point AHK to the Sysnative directory:

PrintScreen::Run, "C:\Windows\Sysnative\SnippingTool.exe"
Related Question