F8로 동작 on/off 설정.
#Requires AutoHotkey v2.0
#SingleInstance Force
CoordMode "Mouse", "Screen"
SetMouseDelay -1
; =========================
; 설정
; =========================
offsetX := 560
offsetY := 0
enabled := true
startX := 0
startY := 0
; =========================
; F8 : ON/OFF 토글
; =========================
F8::{
global enabled
enabled := !enabled
if enabled
TrayTip "Macro", "ON"
else
TrayTip "Macro", "OFF"
}
; =========================
; 마우스 누름
; =========================
~LButton::{
global startX, startY, enabled
if !enabled
return
MouseGetPos &startX, &startY
}
; =========================
; 마우스 뗌
; =========================
~LButton Up::{
global startX, startY
global offsetX, offsetY
global enabled
if !enabled
return
MouseGetPos &endX, &endY
dx := Abs(endX - startX)
dy := Abs(endY - startY)
MouseGetPos &originalX, &originalY
cloneStartX := startX + offsetX
cloneStartY := startY + offsetY
cloneEndX := endX + offsetX
cloneEndY := endY + offsetY
; =========================
; 클릭 처리 (SendInput)
; =========================
if (dx < 5 && dy < 5)
{
DllCall("SetCursorPos", "int", cloneStartX, "int", cloneStartY)
SendInput "{LButton}"
}
; =========================
; 드래그 처리 (SendInput 기반)
; =========================
else
{
DllCall("SetCursorPos", "int", cloneStartX, "int", cloneStartY)
SendInput "{LButton Down}"
MouseMove cloneEndX, cloneEndY, 0
SendInput "{LButton Up}"
}
; 원래 위치 복귀
DllCall("SetCursorPos", "int", originalX, "int", originalY)
}
; =========================
; ESC 종료
; =========================
Esc::ExitApp