현재 마우스 커서의 상태를 구하는 방법에 대하여 알아보겠습니다. Autoit 편집기의 도움말에서 MouseGetCursor 의 Example 를 가져오면 다음과 같은 내용을 확인 할 수 있습니다.

 

#include <MsgBoxConstants.au3>

Sleep(1000) ; Allow time for the cursor to change its state.

; Create an array of possible cursor states using StringSplit.
Local $aArray = StringSplit("Hand|AppStarting|Arrow|Cross|Help|IBeam|Icon (obsolete)|No|" & _
        "Size (obsolete)|SizeAll|SizeNESW|SizeNS|SizeNWSE|SizeWE|UpArrow|Wait|Empty", "|", 2) ; The flag parameter is set to flag = 2 as we don't require the total count of the array.
#cs
    The array returned will contain the following values:
    $aArray[0] = "Hand"
    $aArray[1] = "AppStarting"
    $aArray[2] = "Arrow"
    ...
    $aArray[16] = "Empty"
#ce

Local $iCursor = MouseGetCursor()
MsgBox($MB_SYSTEMMODAL, "CursorID = " & $iCursor, "Which means " & $aArray[$iCursor] & ".") ; Use the CursorID value as the index value of the array

 

이중 동작에 실질적으로 영향을 주는 스크립트는 다음과 같습니다.

#include <MsgBoxConstants.au3>
Local $aArray = StringSplit("Hand|AppStarting|Arrow|Cross|Help|IBeam|Icon (obsolete)|No|" & _
        "Size (obsolete)|SizeAll|SizeNESW|SizeNS|SizeNWSE|SizeWE|UpArrow|Wait|Empty", "|", 2) ; The flag parameter is set to flag = 2 as we don't require the total count of the array.
Local $iCursor = MouseGetCursor()
MsgBox($MB_SYSTEMMODAL, "CursorID = " & $iCursor, "Which means " & $aArray[$iCursor] & ".") ; Use the CursorID value as the index value of the array

 

 

먼저 첫번째 줄은 StringSplit 를 활용하여 배열을 만드는 방법입니다. 이 배열에 대하여 확인을 위해서는 다음과 같이 입력하면 확인 가능합니다.

#include <MsgBoxConstants.au3>
#include <Array.au3>
Local $aArray = StringSplit("Hand|AppStarting|Arrow|Cross|Help|IBeam|Icon (obsolete)|No|" & _
        "Size (obsolete)|SizeAll|SizeNESW|SizeNS|SizeNWSE|SizeWE|UpArrow|Wait|Empty", "|", 2) ; The flag parameter is set to flag = 2 as we don't require the total count of the array.
_ArrayDisplay($aArray)

 

 

이 배열 값은 마우스 상태의 번호값을 String으로 변환하여 보여주는 역활을 해주게 됩니다. 이제 현재 마우스 상태를 숫자값으로 가져오는 MouseGetCursor 으로 숫자값을 가져 옵니다. 

Local $iCursor = MouseGetCursor()

 

그후 가져온 마우스 상태 번호를 활용하여 배열의 값을 메세지 박스로 표시해줍니다.

 

RPA에서 해당값을 사용하는 방법으로는 제품위에 마우스를 위치 시킨 후 마우스가 로딩중으로 표시되는 것은 아닌지 확인하는 방식으로 활용 가능합니다.

+ Recent posts