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

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









#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

    ; =========================
    ; 클릭 처리
    ; =========================
    if (dx < 5 && dy < 5)
    {
        DllCall("SetCursorPos", "int", cloneStartX, "int", cloneStartY)

        Sleep 10

        SendLevel 0
        Click
        SendLevel 1
    }
    ; =========================
    ; 드래그 처리
    ; =========================
    else
    {
        DllCall("SetCursorPos", "int", cloneStartX, "int", cloneStartY)

        Sleep 10

        SendLevel 0
        SendEvent "{LButton Down}"
        SendLevel 1

        Sleep 10

        MouseMove cloneEndX, cloneEndY, 0

        Sleep 10

        SendLevel 0
        SendEvent "{LButton Up}"
        SendLevel 1
    }

    Sleep 10

    ; 원래 위치 복귀
    DllCall("SetCursorPos", "int", originalX, "int", originalY)
}

; =========================
; ESC 종료
; =========================
Esc::ExitApp
댓글
  • No Nickname
    No Comment
  • 권한이 없습니다.
    {{m_row.m_nick}}
    -
목록형 📷 갤러리형
제목
[기본형] HTML (with 부트스트랩5.3 , jquery 3.7, vue.js)
유용한 리눅스(LINUX) 명령어
[공지] 기술 게시판
4.26
4.27
4.28
4.29
4.30
5.1
5.2
5.3
5.4
5.5
5.7
5.8
5.9
5.10
5.13
5.14
5.15
5.16
5.17
5.19
5.21
5.22
5.23
5.24
5.25
5.26
5.27
5.28
5.29
5.30
5.31
6.1
6.2
6.3
6.4
6.5
6.6