Cannot get Windows snipping tool to auto run with AutoHotKey

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"

Use

PrintScreen::Run C:\Windows\explorer.exe C:\Windows\system32\SnippingTool.exe

This will correctly call the executable withing the boundaries of the WoW64 Filesystem Redirection


You can determine if you need to call SnippingTool.exe from the Sysnative or the windows32 based on whether autohotkey is running as a Wow64 process or not.

PrintScreen::LaunchSnippingTool()

; Determines if we are running a 32 bit program (autohotkey) on 64 bit Windows
IsWow64Process()
{
   hProcess := DllCall("kernel32\GetCurrentProcess")
   ret := DllCall("kernel32\IsWow64Process", "UInt", hProcess, "UInt *", bIsWOW64)
   return ret & bIsWOW64
}

; Launch snipping tool using correct path based on 64 bit or 32 bit Windows
LaunchSnippingTool()
{
    if(IsWow64Process())
    {
        Run, %windir%\Sysnative\SnippingTool.exe
    }
    else
    {
        Run, %windir%\system32\SnippingTool.exe
    }
}

More info and source for IsWow64Process here: http://www.autohotkey.com/community/viewtopic.php?t=22277


Use

PrintScreen::Send #+s

Windows + Shift + S is the default short key on Windows