매크로

조회 수 969 추천 0 댓글 9

팁게시판의 호로록님께서 작년에 올린글 보고 질문드립니다.


공유해주신 소스를 ? <- 이표시 다 지우고


제 스크립트 맨 밑에 붙여넣고..


제가 원하는 위치에(특정 행동이 끝난후)


올려주신 명령어 CaptureScreen(2, False, sFileTo,100)를 넣어서


작동시켜봤는데 스크린샷이 안찍히네요...


왜 그럴까요.. 도움이 필요합니다 ㅠㅠ


여담으로, 올려주신 스크립트 중

If sFileTo? =
sFileTo := A_ScriptDir . "\screen.bmp"
SplitPath, sFileTo, , sDirTo, sExtTo, sNameTo


부분을 읽어보면 스크립트가 있는 폴더에 screen.bmp로 저장하는걸로 이해가 되는데..


현재날짜및시간으로 저장되게 할수있을까요?


앱플레이어는 녹스 사용중입니다.(비활성적용시켜서요)


고수님들 도움이 필요합니다 ㅠㅠ 도와주세요!!


  • profile
    북붕 2016.04.30 21:06
    주신 내용만으론 왜 스크린샷이 안 되는지 잘 모르겠네요.

    시간은 "screen"%시간에대한 변수%".bmp% 이렇게 하면 되지 않을까요
  • 제발등업좀2 2016.04.30 23:25
    스키립캡쳐 라이브러리...자체를 좀수정하셔야할수도있어요... 뭐였지... 윈도우버젼이던가 기억이 안나지만... 그부분때문에 제대로 작동을 안하던것같은데 ... 수정한다고 용써돈 기억이 있는데.. 여튼 그래서일껍니다.
  • Only미 2016.05.01 13:39
    ㅠㅠ 자세한 설명 가능하신지요.. 계속 작동을 안하네요..
  • Only미 2016.05.01 13:42

    '획득'이라는 이미지를 찾고


    CaptureScreen(2, False, sFileTo, 100)


    이 소스를 붙여넣고


    클릭하게 했습니다.


    아래는 스크립트 밑에 붙여넣기하라고 하신

    팁 에 있는 코드입니다.


    CaptureScreen(aRect = 0, bCursor = False, sFile = "", nQuality = "")
    {
    If !aRect
    {
    SysGet, nL, 76
    SysGet, nT, 77
    SysGet, nW, 78
    SysGet, nH, 79
    }
    Else If aRect = 1
    WinGetPos, nL, nT, nW, nH, A
    Else If aRect = 2
    {
    WinGet, hWnd, ID, A
    VarSetCapacity(rt, 16, 0)
    DllCall("GetClientRect" , "Uint", hWnd, "Uint", &rt)
    DllCall("ClientToScreen", "Uint", hWnd, "Uint", &rt)
    nL := NumGet(rt, 0, "int")
    nT := NumGet(rt, 4, "int")
    nW := NumGet(rt, 8)
    nH := NumGet(rt,12)
    }
    Else If aRect = 3
    {
    VarSetCapacity(mi, 40, 0)
    DllCall("GetCursorPos", "int64P", pt)
    DllCall("GetMonitorInfo", "Uint", DllCall("MonitorFromPoint", "int64", pt, "Uint", 2), "Uint", NumPut(40,mi)-4)
    nL := NumGet(mi, 4, "int")
    nT := NumGet(mi, 8, "int")
    nW := NumGet(mi,12, "int") - nL
    nH := NumGet(mi,16, "int") - nT
    }
    Else
    {
    StringSplit, rt, aRect, `,, %A_Space%%A_Tab%
    nL := rt1
    nT := rt2
    nW := rt3 - rt1
    nH := rt4 - rt2
    znW := rt5
    znH := rt6
    }

    mDC := DllCall("CreateCompatibleDC", "Uint", 0)
    hBM := CreateDIBSection(mDC, nW, nH)
    oBM := DllCall("SelectObject", "Uint", mDC, "Uint", hBM)
    hDC := DllCall("GetDC", "Uint", 0)
    DllCall("BitBlt", "Uint", mDC, "int", 0, "int", 0, "int", nW, "int", nH, "Uint", hDC, "int", nL, "int", nT, "Uint", 0x40000000 | 0x00CC0020)
    DllCall("ReleaseDC", "Uint", 0, "Uint", hDC)
    If bCursor
    CaptureCursor(mDC, nL, nT)
    DllCall("SelectObject", "Uint", mDC, "Uint", oBM)
    DllCall("DeleteDC", "Uint", mDC)
    If znW && znH
    hBM := Zoomer(hBM, nW, nH, znW, znH)
    If sFile = 0
    SetClipboardData(hBM)
    Else Convert(hBM, sFile, nQuality), DllCall("DeleteObject", "Uint", hBM)
    }

    CaptureCursor(hDC, nL, nT)
    {
    VarSetCapacity(mi, 20, 0)
    mi := Chr(20)
    DllCall("GetCursorInfo", "Uint", &mi)
    bShow? := NumGet(mi, 4)
    hCursor := NumGet(mi, 8)
    xCursor := NumGet(mi,12)
    yCursor := NumGet(mi,16)

    VarSetCapacity(ni, 20, 0)
    DllCall("GetIconInfo", "Uint", hCursor, "Uint", &ni)
    xHotspot := NumGet(ni, 4)
    yHotspot := NumGet(ni, 8)
    hBMMask? := NumGet(ni,12)
    hBMColor := NumGet(ni,16)

    If bShow
    DllCall("DrawIcon", "Uint", hDC, "int", xCursor - xHotspot - nL, "int", yCursor - yHotspot - nT, "Uint", hCursor)
    If hBMMask
    DllCall("DeleteObject", "Uint", hBMMask)
    If hBMColor
    DllCall("DeleteObject", "Uint", hBMColor)
    }

    Zoomer(hBM, nW, nH, znW, znH)
    {
    mDC1 := DllCall("CreateCompatibleDC", "Uint", 0)
    mDC2 := DllCall("CreateCompatibleDC", "Uint", 0)
    zhBM := CreateDIBSection(mDC2, znW, znH)
    oBM1 := DllCall("SelectObject", "Uint", mDC1, "Uint",? hBM)
    oBM2 := DllCall("SelectObject", "Uint", mDC2, "Uint", zhBM)
    DllCall("SetStretchBltMode", "Uint", mDC2, "int", 4)
    DllCall("StretchBlt", "Uint", mDC2, "int", 0, "int", 0, "int", znW, "int", znH, "Uint", mDC1, "int", 0, "int", 0, "int", nW, "int", nH, "Uint", 0x00CC0020)
    DllCall("SelectObject", "Uint", mDC1, "Uint", oBM1)
    DllCall("SelectObject", "Uint", mDC2, "Uint", oBM2)
    DllCall("DeleteDC", "Uint", mDC1)
    DllCall("DeleteDC", "Uint", mDC2)
    DllCall("DeleteObject", "Uint", hBM)
    Return zhBM
    }

    Convert(sFileFr = "", sFileTo = "", nQuality = "")
    {
    If sFileTo =
    formatTime, 현재시간, YYYYMMDDH24ms, YYYYMMDDH24ms
    sFileTo := A_ScriptDir . "\%현재시간%.bmp"
    SplitPath, sFileTo, , sDirTo, sExtTo, sNameTo

    If Not hGdiPlus := DllCall("LoadLibrary", "str", "gdiplus.dll")
    Return sFileFr+0 ? SaveHBITMAPToFile(sFileFr, sDirTo . "\" . sNameTo . ".bmp") : ""
    VarSetCapacity(si, 16, 0), si := Chr(1)
    DllCall("gdiplus\GdiplusStartup", "UintP", pToken, "Uint", &si, "Uint", 0)

    If !sFileFr
    {
    DllCall("OpenClipboard", "Uint", 0)
    If DllCall("IsClipboardFormatAvailable", "Uint", 2) && (hBM:=DllCall("GetClipboardData", "Uint", 2))
    DllCall("gdiplus\GdipCreateBitmapFromHBITMAP", "Uint", hBM, "Uint", 0, "UintP", pImage)
    DllCall("CloseClipboard")
    }
    Else If sFileFr Is Integer
    DllCall("gdiplus\GdipCreateBitmapFromHBITMAP", "Uint", sFileFr, "Uint", 0, "UintP", pImage)
    Else DllCall("gdiplus\GdipLoadImageFromFile", "Uint", Unicode4Ansi(wFileFr,sFileFr), "UintP", pImage)

    DllCall("gdiplus\GdipGetImageEncodersSize", "UintP", nCount, "UintP", nSize)
    VarSetCapacity(ci,nSize,0)
    DllCall("gdiplus\GdipGetImageEncoders", "Uint", nCount, "Uint", nSize, "Uint", &ci)
    Loop, % nCount
    If InStr(Ansi4Unicode(NumGet(ci,76*(A_Index-1)+44)), "." . sExtTo)
    {
    pCodec := &ci+76*(A_Index-1)
    Break
    }
    If InStr(".JPG.JPEG.JPE.JFIF", "." . sExtTo) && nQuality<>"" && pImage && pCodec
    {
    DllCall("gdiplus\GdipGetEncoderParameterListSize", "Uint", pImage, "Uint", pCodec, "UintP", nSize)
    VarSetCapacity(pi,nSize,0)
    DllCall("gdiplus\GdipGetEncoderParameterList", "Uint", pImage, "Uint", pCodec, "Uint", nSize, "Uint", &pi)
    Loop, % NumGet(pi)
    If NumGet(pi,28*(A_Index-1)+20)=1 && NumGet(pi,28*(A_Index-1)+24)=6
    {
    pParam := &pi+28*(A_Index-1)
    NumPut(nQuality,NumGet(NumPut(4,NumPut(1,pParam+0)+20)))
    Break
    }
    }

    If pImage
    pCodec ? DllCall("gdiplus\GdipSaveImageToFile", "Uint", pImage, "Uint", Unicode4Ansi(wFileTo,sFileTo), "Uint", pCodec, "Uint", pParam) : DllCall("gdiplus\GdipCreateHBITMAPFromBitmap", "Uint", pImage, "UintP", hBitmap, "Uint", 0) . SetClipboardData(hBitmap), DllCall("gdiplus\GdipDisposeImage", "Uint", pImage)

    DllCall("gdiplus\GdiplusShutdown" , "Uint", pToken)
    DllCall("FreeLibrary", "Uint", hGdiPlus)
    }

    CreateDIBSection(hDC, nW, nH, bpp = 32, ByRef pBits = "")
    {
    NumPut(VarSetCapacity(bi, 40, 0), bi)
    NumPut(nW, bi, 4)
    NumPut(nH, bi, 8)
    NumPut(bpp, NumPut(1, bi, 12, "UShort"), 0, "Ushort")
    NumPut(0,? bi,16)
    Return DllCall("gdi32\CreateDIBSection", "Uint", hDC, "Uint", &bi, "Uint", 0, "UintP", pBits, "Uint", 0, "Uint", 0)
    }

    SaveHBITMAPToFile(hBitmap, sFile)
    {
    DllCall("GetObject", "Uint", hBitmap, "int", VarSetCapacity(oi,84,0), "Uint", &oi)
    hFile:= DllCall("CreateFile", "Uint", &sFile, "Uint", 0x40000000, "Uint", 0, "Uint", 0, "Uint", 2, "Uint", 0, "Uint", 0)
    DllCall("WriteFile", "Uint", hFile, "int64P", 0x4D42|14+40+NumGet(oi,44)<<16, "Uint", 6, "UintP", 0, "Uint", 0)
    DllCall("WriteFile", "Uint", hFile, "int64P", 54<<32, "Uint", 8, "UintP", 0, "Uint", 0)
    DllCall("WriteFile", "Uint", hFile, "Uint", &oi+24, "Uint", 40, "UintP", 0, "Uint", 0)
    DllCall("WriteFile", "Uint", hFile, "Uint", NumGet(oi,20), "Uint", NumGet(oi,44), "UintP", 0, "Uint", 0)
    DllCall("CloseHandle", "Uint", hFile)
    }

    SetClipboardData(hBitmap)
    {
    DllCall("GetObject", "Uint", hBitmap, "int", VarSetCapacity(oi,84,0), "Uint", &oi)
    hDIB := DllCall("GlobalAlloc", "Uint", 2, "Uint", 40+NumGet(oi,44))
    pDIB := DllCall("GlobalLock", "Uint", hDIB)
    DllCall("RtlMoveMemory", "Uint", pDIB, "Uint", &oi+24, "Uint", 40)
    DllCall("RtlMoveMemory", "Uint", pDIB+40, "Uint", NumGet(oi,20), "Uint", NumGet(oi,44))
    DllCall("GlobalUnlock", "Uint", hDIB)
    DllCall("DeleteObject", "Uint", hBitmap)
    DllCall("OpenClipboard", "Uint", 0)
    DllCall("EmptyClipboard")
    DllCall("SetClipboardData", "Uint", 8, "Uint", hDIB)
    DllCall("CloseClipboard")
    }

    Unicode4Ansi(ByRef wString, sString)
    {
    nSize := DllCall("MultiByteToWideChar", "Uint", 0, "Uint", 0, "Uint", &sString, "int", -1, "Uint", 0, "int", 0)
    VarSetCapacity(wString, nSize * 2)
    DllCall("MultiByteToWideChar", "Uint", 0, "Uint", 0, "Uint", &sString, "int", -1, "Uint", &wString, "int", nSize)
    Return &wString
    }

    Ansi4Unicode(pString)
    {
    nSize := DllCall("WideCharToMultiByte", "Uint", 0, "Uint", 0, "Uint", pString, "int", -1, "Uint", 0, "int",? 0, "Uint", 0, "Uint", 0)
    VarSetCapacity(sString, nSize)
    DllCall("WideCharToMultiByte", "Uint", 0, "Uint", 0, "Uint", pString, "int", -1, "str", sString, "int", nSize, "Uint", 0, "Uint", 0)
    Return sString
    }

  • profile
    셋쇼마루 2016.05.01 21:30
    엄청나게 기네요 ㅋㅋㅋㅋㅋㅋ 대단대단 어떻게 해석하지 흠
  • Only미 2016.05.02 02:15
    팁 글로 올라온 소스에요 ㅜㅜㅋ
    참 난감합니다 저도 ㅠㅠ
  • 리체 2016.05.01 22:06

    Ansi와 Unicode, 32와 64bit 에 따라 dllcall에 쓰이는 문자가 약간 틀립니다.

  • Only미 2016.05.02 02:17
    저는 64비트 사용하고있는데

    어딜 수정해야하는지 알수있을까요 ㅠㅠ
  • 리체 2016.05.02 18:47
    저도 정확히는 잘 모릅니다. 그냥 32비트를 쓰세요.
    포럼의 소스도 32비트용이 많아서 호환성 면에서도 훨씬 좋습니다.

List of Articles
분류 제목 글쓴이 최근변경 추천
질문 이미지서치 딜레이질문 .. 5 혜띠뿌뿌 2016.05.09 0/0
질문 이미지서치 3 PlusK 2016.05.07 0/0
질문 1을 001로, 62를 062로 표현하는 식이 없을까요? 3 북붕 2016.05.09 0/0
질문 보더 값 과 캡션 값에 대하여... 2 앞프론뒷태 2016.05.13 0/0
질문 여기 고수들 많으시네요...질문! 3 셋쇼마루 2016.05.02 0/0
질문 질문하나만 할게요 ~~ 1 깜장별 2016.05.01 0/0
질문 이미지 서치 후 랜덤좌표클릭 적용관련 질문입니다 1 티모티모티모 2016.05.01 0/0
질문 ahk_id %ID% 가 아무런 값을 출력하지 못합니다. 2 북붕 2016.05.01 0/0
질문 내가 실행한 ahk나 exe파일의 경로를 구하고 싶습니다. 1 북붕 2016.05.01 0/0
자유 이미지질문 1 PlusK 2017.11.30 0/0
질문 Gui ListView에서 선택행이 비활성일 경우 문제입니다. 1 우후훅 2017.01.20 0/0
질문 오토핫키로 스크린샷 찍기 질문드립니다. 9 Only미 2016.05.02 0/0
질문 이미지 서치에대해 질문좀드리고싶습니다.. 1 깜장별 2016.08.09 0/0
질문 오토핫키 매크로를 제가 스스로 제작하긴 했는데.. 첫 ... 2 온자춘 2016.04.30 0/0
질문 클릭을 비활성 클릭으로 바꾸려는데, 클릭 위치가 전과... 2 북붕 2016.05.11 0/0
질문 오토핫키는 비활성 이미지서치가 어렵잖아요? 6 북붕 2016.04.29 0/0
질문 이미지 서치 질문입니다. 1 여기저기1 2016.04.28 0/0
질문 이미지서치질문이에요 2 혜띠뿌뿌 2016.04.28 0/0
질문 참조변수 사용법 알려주세요 4 검정다람쥐 2016.04.25 0/0
질문 안녕하세요 현재활성화된 예뮬레이터의 경로를 알수있... 9 제발등업좀2 2016.05.13 0/0
Board Pagination Prev 1 ... 121122123124125126127128129 ... 209 Next
/ 209

전체 최신 인기글

전체 주간 인기글