🧩 Code

ahk2 code

천하나 2024. 8. 9. 10:32

전역설정

#Requires AutoHotkey v2.0
#SingleInstance Force
CoordMode "Mouse", "Screen"
SendMode "Input"  ; 더 빠른 Send 모드를 선택합니다.

Keyboard text

:*:ds]:: 안녕하세요 
:*:rt]:: 감사합니다

ws := "2503 1313"  ; Variables 
click ws
N := Random(2222, 3333)
sleep N

Send "{LWin Down} {1} {lwin up}"
Send "#z" 

^t::
SendInput "{LButton}" . FormatTime(,"HH:mm:ss")  ; 커서 클릭 시간
Send  A_YYYY "년 " a_mm "월 " A_dd "일 "

^t::  ; time
{
    Send A_YYYY "년 " a_mm "월 " A_dd "일 "
}

~a & d::  ; a + d
f1::f1   ;  f1 고유기능 사용 - 예외처리

Mouse Click

CoordMode "Mouse", "Screen"
SetDefaultMouseSpeed 0 ; default 2

 MouseGetPos &x , &y
  Click 100, 200, 2   ; x y 2 clicks
  Click "2401 999 r"  ; 0 move / L R wu wd 
  MouseClickDrag "left", 2321, 855 , 2105, 1147 ; xy xy2 speed
 MouseMove x,y

F8::  {    MouseGetPos &x , &y
    A_Clipboard := "click " . x . ", " . y . " `n" . "sleep 155 `n"
    A_Clipboard := "click `"" . x . " " . y . "`" `n" . "sleep 155 `n"
    Send("^v")
}

asci code ` ; " 따음 / n 뉴라인 / r 리턴 등

윈도우

#HotIf WinActive("ahk_exe msedge.exe") or ... ; 활성 윈도우 동작
#HotIf  ; To turn off context sensitivity, specify #HotIf without any expression.

if WinExist("ahk_exe msedge.exe") or ...   ; 창 닫기  or winkill 
   WinClose ; Use the window found by WinExist

GroupAdd "f1", "ahk_exe explorer.exe"   ; 그룹 선언
GroupAdd "f1", "ahk_exe msedge.exe"
#HotIf WinActive("ahk_group f1")  

WinGetTitle("Browse :: Sukebei")  ; 특정 탭에서만 동작

Run "D:\Data.exe"   ; run

반복 토글 - 함수

global toggle := false

n24(*)  ; f12 ckck
{
    global toggle
    toggle := !toggle

    if (toggle)
    {
        SetTimer Ree, true
    }
    else {
        SetTimer Ree, false
        Reload
    }

    Ree(*)
    {
        ToolTip " Click "
        AHI.SendMouseButtonEvent(11, 0, 1) AHI.SendMouseButtonEvent(11, 0, 0)
        Sleep k
        tooltip  ; off the tooltip
    } }

반복 다운로드

^'::
{ activeTitle := WinGetTitle("A")
    if InStr(activeTitle, "Browse :: Sukebei")
    { Loop 30 {
        Click 1797, 341 + (A_Index - 1) * 55
        Sleep 222
    } } 
}

Clipboard 파일

::/ur::  ; /ur 입력시 ur.txt 불러오기
{   A_Clipboard := FileRead("D:\Work\Doc\_code\ahk\ur.txt")
 Send '^v'
}

FileAppend "Another line.`n", "D:\Work\Doc\_code\ahk\ur.txt"  ; 파일 쓰기
FileAppend A_Clipboard , "D:\Data\Utility\Essential\Text\Notepad++\new1.txt"

A_Clipboard := "click `"" . x . " " . y . "`" `n" . "sleep 55 `n"  ; `n `t `"

TraySetIcon "D:\Data\Utility\_Install_Apps\Theme\Icons\su_con (1).ico"
TraySetIcon "imageres.dll", 77
TraySetIcon "Shell32.dll", 111

PixelGetColor

F3::
PixelGetColor, color, x좌표, y좌표 ; x좌표와 y좌표에는 클릭하려는 위치의 좌표를 입력하세요.
if (color != 0xFFFFFF) ; 흰색이 아닐 경우 (흰색의 RGB 값은 0xFFFFFF입니다)
{
    Click ; 클릭 실행
}
return

절전모드

#\::  ;  모니터 끄기
{
    Sleep 1000  ; Give user a chance to release keys (in case their release would wake up the monitor again).
    SendMessage 0x0112, 0xF170, 2,, "Program Manager"  ; 0x0112 is WM_SYSCOMMAND, 0xF170 is SC_MONITORPOWER.
}

^#\::  ; 컴퓨터 절전모드
{
    DllCall("powrprof.dll\SetSuspendState", "Int", 0, "Int", 1, "Int", 0)
}

; 모니터 입력 전환 hdmi to dp

 

https://www.autohotkey.com/docs/v2/