매크로

질문
2019.02.22 18:06

이 소스 내용이 뭔가요?

조회 수 2488 추천 0 댓글 0

인터넷에서 클래스DD관련해서 찾다가 뭔가 대단해보이는 소스를 찾았는데

이거 그냥 DD호출하는 소스가 맞나요?

이거 글만 길게 썼다뿐이지, include, class_dd.ahk 이거랑 똑같은거죠?


class DD extends DD_Helper
{
        ; Simulate mouse button press
        ; param:   1 = LButton Down,    2 = LButton Up
        ;          4 = RButton Down,    8 = RButton Up
        ;         16 = MButton Down,   32 = MButton Up
        ;         64 = Button 4 Down, 128 = Button 4 Up
        ;        256 = Button 5 Down, 512 = Button 5 Up
        btn(param) {
                return DllCall(this.dllFile "\DD_btn", "int", param)
        }
    
        ; Simulate mouse move
        mov(x, y) {
                return DllCall(this.dllFile "\DD_mov", "int", x, "int", y)
        }
    
        ; Simulate mouse move (relatively)
        movR(dx, dy) {
                return DllCall(this.dllFile "\DD_movR", "int", dx, "int", dy)
        }
    
        ; Simulate mouse wheel
        ; param: 1=upward 2=downward
        whl(param) {
                return DllCall(this.dllFile "\DD_whl", "int", param)
        }
    
        ; Simulate keyboard
        ; param1: DD code
        ; param2: 1=Down 2=Up
        key(param1, param2) {
                return DllCall(this.dllFile "\DD_key", "int", param1, "int", param2)
        }
    
        ; VKCode to DD code
        todc(VKCode) {
                return DllCall(this.dllFile "\DD_todc", "int", VKCode)
        }
    
        ; Send string
        str(string) {
                return DllCall(this.dllFile "\DD_str", "astr", string)
        }
    
        ; Get hwnd of active window
        GetActiveWindow() {
                ; return DllCall(this.dllFile "\DD_GetActiveWindow", "ptr") ; seems not working
                return WinExist("A")
        }
    
        MouseMove(hwnd, x, y) {
                return DllCall(this.dllFile "\DD_MouseMove", "ptr", hwnd, "int", x, "int", y)
        }
    
        ; The picture is saved to "C:\DD Snap\" folder
        SnapPic(hwnd, x, y, w, h) {
                return DllCall(this.dllFile "\DD_SnapPic", "ptr", hwnd, "int", x, "int", y, "int", w, "int", h)
        }
    
        PickColor(hwnd, x, y, mode=2) {
                return DllCall(this.dllFile "\DD_PickColor", "ptr", hwnd, "int", x, "int", y, "int", mode)
        }
}

class DD_Helper
{
        static _ := DD_Helper.InitClass()
    
        InitClass() {
                if !A_IsAdmin {
                        Run *RunAs "%A_ScriptFullPath%"  ; Requires v1.0.92.01+
                        ExitApp
                }
                this.LoadDll()
        }
    
        LoadDll() {
                if A_Is64bitOS {
                        dllFile := (A_PtrSize=8) ? "DD\64\ddx64.64.dll" : "DD\64\ddx64.32.dll"
                } else {
                        dllFile := "DD\32\ddx32.dll"
                }
        
                if !this.hModule := DllCall("LoadLibrary", "Str", dllFile, "Ptr") {
                        if !FileExist(dllFile) {
                                throw, dllFile " not found."
                        }
                        throw, "LoadLibrary failed. DllFile is " dllFile
                }
                this.dllFile := dllFile
        }
    
        UnloadDll() {
                DllCall("FreeLibrary", "Ptr", this.hModule)
        }
        
        ; Example: _btn("RButtonDown")
        _btn(sNick, x:="", y:="") {
                static oNick := { LButtonDown: 1, LButtonUp: 2
                                , RButtonDown: 4, RButtonUp: 8
                                , MButtonDown: 16, MButtonUp: 32
                                , 4ButtonDown: 64, 4ButtonUp: 128
                                , 5ButtonDown: 256, 5ButtonUp: 512 }
                if !( n := oNick[sNick] ) {
                        throw, sNick " is not a valid nick."
                }
                if (x != "") {
                        this.mov(x, y)
                }
                this.btn(n)
        }
    
        ; Example: _btn_press("RButton")
        _btn_press(sNick, x:="", y:="", nCount:=1) {
                static oNick := { LButton: {Down: 1, Up: 2}
                                , RButton: {Down: 4, Up: 8}
                                , MButton: {Down: 16, Up: 32}
                                , 4Button: {Down: 64, Up: 128}
                                , 5Button: {Down: 256, Up: 512} }
                if !( o := oNick[sNick] ) {
                        throw, sNick " is not a valid nick."
                }
                if (x != "") {
                        this.mov(x, y)
                }
                Loop, % nCount {
                        this.btn( o.Down )
                        this.btn( o.Up )
                        Sleep, 5
                }
        }
    
        ; Example: _key("F11", "Down")
        ;          _key("F11", "Up")
        _key(sKey, sflag) {
                ddCode := this.todc( GetKeyVK(sKey) )
                this.key(ddCode, (sflag="Up") ? 2 : 1 )
        }
    
        ; Example: _key_press("F11")
        ;          _key_press("Ctrl", "A")
        _key_press(sKey*) {
                arr_ddCode := []
        
                for i, k in sKey {
                        arr_ddCode[i] := this.todc( GetKeyVK(k) )
                        this.key(arr_ddCode[i], 1) ; Down
                }
                for i, ddCode in arr_ddCode {
                        this.key(ddCode, 2) ; Up
                }
        }
    
        _key_pressEx(sKey, nCount := 1) {
                ddCode := this.todc( GetKeyVK(sKey) )
        
                Loop, % nCount {
                        this.key(ddCode, 1) ; Down
                        this.key(ddCode, 2) ; Up
                }
        }
    
        ; Example: _whl("down")
        ;          _whl("up")
        _whl(sParam) {
                this.whl( (sParam="Up") ? 1 : 2 )
        }
}



List of Articles
분류 제목 글쓴이 최근변경 추천
자유 블루스택과 녹스에서 히트 돌릴때 색상차이 8 와이로 2017.11.09 4/0
정보 간단한 방법으로 길오아 오토핫키를 만들어보세요^^ 21 럭셔리형아 2018.02.07 4/0
정보 MS오피스 스타일 GUI 프로토타입 6 예지력1 2016.04.16 4/0
질문 오토핫키 에디터 제작. 9 프리헌터스 2015.09.11 4/0
정보 테일스타 내 포인트 조회기 16 와이로 2017.07.04 4/0
정보 팝업 알림, CleanNotify 3 예지력1 2015.11.11 4/0
정보 브레이브 헌터 ... 매크로.. 1 제발등업좀2 2015.07.10 4/0
자유 비활성이미지서치 중간정리(disp,adb) 11 우후훅 2017.04.03 4/0
정보 블루스택 해상도 변경하기... 10 로뎀나무 2015.04.15 4/0
자유 [AutoPM Ver 1.58] 포켓메이플스토리 매크로 8 은다 2015.04.25 4/0
정보 초보가 초보에게;; 핫키 사용법 8 악동주성 2016.09.03 4/0
질문 매크로좀 오랜만에 다시보고자 접속을... 7 joeypre 2021.09.27 3/0
자유 오랜만에 글남깁니다 ㅋ. 매우많이.. 늦었지만 복들 ... 3 제발등업좀2 2016.01.10 3/0
정보 앱아이콘 터치없이 adb로 앱 실행 시키는 방법 18 와이로 2021.01.23 3/0
정보 오토핫키를 간단히 쓰고싶지만 너무 어렵다고 느낄때 9 HyunsD 2018.02.07 3/0
정보 제가 쓰는 픽셀피커입니다(스크립트) 6 와이로 2017.02.11 3/0
정보 지니모션 디바이스(타이틀) 검색 ddl 소스 9 핸콕 2015.10.11 3/0
질문 텍스트를 가져오고 싶습니다. 6 _Crash 2022.12.14 3/0
정보 INI 를 쉽게 사용해봅시다. 11 모바게 2017.11.01 3/0
정보 DynaScript - Child 프로세스로 코드 실행 13 예지력1 2019.07.16 3/0
Board Pagination Prev 1 2345678910 ... 209 Next
/ 209

전체 최신 인기글

전체 주간 인기글