1. 소개
AutoHotKey는 혼자서는 아무것도 하지 않는다. AutoHotKey가 무엇인가를 하기 위해서 스크립트 파일이 필요하다. 스크립트 파일은 파일 확장자가 ".ahk"인 텍스트 파일이다.
(예)
^F1::

if WinExist("[Edit4] - UltraEdit")
        WinActivate
else
        Run uedit32 Hello.txt
return



2. 스크립트 만들기
텍스트 에디터르 스크립트 파일을 작성하고 파일 확장자를 ".ahk" 으로 저장한다.



3. 스크립트 편집하기
스크립트가 실행 중일 때 스크립트를 편집하려면 트레이 아이콘에서 "Edit This Script"를 선택한다.



4. 스크립트 실행하기
(1) 스크립트 실행 방법
스크립트를 실행하는 방법에는 몇 가지 방법이 있다.
① 스크립트 파일 더블 클릭하기
② 명령 프롬프트에서 AutoHotKey.exe 프로그램 실행하기
(2) 명령 프롬프트에서 실행하기
① 형식
AutoHotkey.exe [Switches] [Script Filename] [Script Parameters]
② 컴파일된 스크립트 파일인 경우 다음과 같이 실행한다.
CompiledScript.exe [Switches] [Script Parameters]
③ Switches 항목
● /f or /force Launch unconditionally, skipping any warning dialogs. This has the same effect as #SingleInstance Off. Yes 
● /r or /restart Indicate that the script is being restarted (this is also used by the Reload command, internally). Yes 
● /ErrorStdOut Send syntax errors that prevent a script from launching to stderr rather than displaying a dialog. See #ErrorStdOut for details. This can be combined with /iLib to validate the script without running it. Yes 
● /Debug [v1.0.90+]: Connect to a debugging client. For more details, see Interactive Debugging. No 
● /CPn [v1.0.90+]: Overrides the default codepage used to read script files. For more details, see Script File Codepage. No 
● /iLib "OutFile" [v1.0.47+]: AutoHotkey loads the script but does not run it. For each script file which is auto-included via the library mechanism, two lines are written to the file specified by OutFile. These lines are written in the following format, where LibDir is the full path of the Lib folder and LibFile is the filename of the library:#Include LibDir\#IncludeAgain LibDir\LibFile.ahkIf the output file exists, it is overwritten. OutFile can be * to write the output to stdout.If the script contains syntax errors, the output file may be empty. The process exit code can be used to detect this condition; if there is a syntax error, the exit code is 2. The /ErrorStdOut switch can be used to suppress or capture the error message.
④ Script Filename
Script Parameters가 없을 경우 생략가능하다. 
⑤ Script Parameters
매개변수는 내장된 A_Args 변수에 배열로 저장되고 A_Args[1] 과 같이 접근가능하다.
(예)
^F1::



for n, param in A_Args
{
        OutputDebug  [ %n% ] %param%
}

return



5. 메인 윈도우
스크립트 메인 윈도우는 보통 숨겨져 있다. 메인 윈도우를 보려면 트레이 아이콘에서 Open을 선택하거나 스크립트 파일 안에서 다음 명령을 실행하면 활성화된다.
ListLines
ListVars
ListHotKeys
KeyHistory

'' 카테고리의 다른 글

AutoHotKey 스크립트 언어  (0) 2020.01.08
윈도우 10 최적화하기  (0) 2020.01.05
ImDisk, mklink.exe Altium Online Viewer, SSD 최적화  (0) 2020.01.05

+ Recent posts