PRINTSCREENAUTOHOTKEY로 키보드 버튼을 눌렀을 때 Windows 7 스니핑 도구를 실행하려고합니다 .
나는 지금까지 실패했다. 다음은 AutoHotKey 스크립트에 대한 것입니다.
나는 이것을 시도했다
PRINTSCREEN::Run, c:\windows\system32\SnippingTool.exe
이
PRINTSCREEN::Run, SnippingTool.exe
이
PRINTSCREEN::Run, SnippingTool
그리고 모든 파일은 기본적으로 파일을 찾을 수 없다는 오류 메시지를 표시하지만 파일 경로가 올바른 것 같습니다. 파일을 창에 붙여 넣을 수 있으며 스니핑 도구를 열 수 있습니다. 왜 작동하지 않을까요?
내 AHK 파일의 전체 코드는 다음과 같습니다.
;
; 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
답변
우연히 64 비트 버전의 Windows 7을 실행하고 있습니까?
Windows 7 (및 Vista 생각)은 WoW64 파일 시스템 리디렉션을 구현합니다. 이 경우 AHK를 Sysnative 디렉토리로 지정하십시오.
PrintScreen :: Run, "C : \ Windows \ Sysnative \ SnippingTool.exe"
답변
사용하다
PrintScreen :: 실행 C : \ Windows \ explorer.exe C : \ Windows \ system32 \ SnippingTool.exe
WoW64 파일 시스템 리디렉션의 경계를 사용하여 실행 파일을 올바르게 호출합니다.
답변
autohotkey가 Wow64 프로세스로 실행 중인지 여부에 따라 Sysnative 또는 windows32에서 SnippingTool.exe를 호출해야하는지 여부를 결정할 수 있습니다.
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
}
}
IsWow64Process에 대한 자세한 정보 및 소스는 여기 ( http://www.autohotkey.com/community/viewtopic.php?t=22277)