duplicateMouse.ahk autohotkey 용 마우스 움직임 복제

new
F8로 동작 on/off 설정.
ESC로 종료


sleep 제거






#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
댓글
  • No Nickname
    No Comment
  • 권한이 없습니다.
    {{m_row.m_nick}}
    -
제목 작성자 날짜
공대여자
공대여자
mins01
공대여자
공대여자
공대여자
공대여자
공대여자
공대여자
공대여자
공대여자
공대여자
공대여자
공대여자
공대여자
공대여자
공대여자
공대여자