결과 실행 파일 : -주의사항 :아래 EXE 파일은 위 소스를 EXE로 변경하여 빠른 실행을 도와 주는 파일입니다. 인터넷에서 다운 받은 EXE의 경우보안알림이 뜰 확률이매우높습니다. 관련 메세지가 불안하신 경우 위에 AU3 파일이나 상단 링크의 스크립트 소스를 이용해서 직접 빌드해서 사용하시면 됩니다.
결과 실행 파일 : -주의사항 :아래 EXE 파일은 위 소스를 EXE로 변경하여 빠른 실행을 도와 주는 파일입니다. 인터넷에서 다운 받은 EXE의 경우보안알림이 뜰 확률이매우높습니다. 관련 메세지가 불안하신 경우 위에 AU3 파일이나 상단 링크의 스크립트 소스를 이용해서 직접 빌드해서 사용하시면 됩니다.
글자 형식을 변경하는 방법에 대하여 알아보겠습니다. Autoit 편집기의 도움말에서 BinaryToString 의 Example 를 가져오면 다음과 같은 내용을 확인 할 수 있습니다.
해당 Script를 실행하면 4번의 대화상자가 나타나며 일부 글자는 깨져서 표시 되는 것을 확인 할 수 있습니다.
#include <MsgBoxConstants.au3>
#include <StringConstants.au3>
Example()
Func Example()
; Define the string that will be converted later.
; NOTE: This string may show up as ?? in the help file and even in some editors.
; This example is saved as UTF-8 with BOM. It should display correctly in editors
; which support changing code pages based on BOMs.
Local Const $sString = "Hello - 你好"
; Temporary variables used to store conversion results. $dBinary will hold
; the original string in binary form and $sConverted will hold the result
; afte it's been transformed back to the original format.
Local $dBinary = Binary(""), $sConverted = ""
; Convert the original UTF-8 string to an ANSI compatible binary string.
$dBinary = StringToBinary($sString)
; Convert the ANSI compatible binary string back into a string.
$sConverted = BinaryToString($dBinary)
; Display the resulsts. Note that the last two characters will appear
; as ?? since they cannot be represented in ANSI.
DisplayResults($sString, $dBinary, $sConverted, "ANSI")
; Convert the original UTF-8 string to an UTF16-LE binary string.
$dBinary = StringToBinary($sString, $SB_UTF16LE)
; Convert the UTF16-LE binary string back into a string.
$sConverted = BinaryToString($dBinary, $SB_UTF16LE)
; Display the resulsts.
DisplayResults($sString, $dBinary, $sConverted, "UTF16-LE")
; Convert the original UTF-8 string to an UTF16-BE binary string.
$dBinary = StringToBinary($sString, $SB_UTF16BE)
; Convert the UTF16-BE binary string back into a string.
$sConverted = BinaryToString($dBinary, $SB_UTF16BE)
; Display the resulsts.
DisplayResults($sString, $dBinary, $sConverted, "UTF16-BE")
; Convert the original UTF-8 string to an UTF-8 binary string.
$dBinary = StringToBinary($sString, $SB_UTF8)
; Convert the UTF8 binary string back into a string.
$sConverted = BinaryToString($dBinary, $SB_UTF8)
; Display the resulsts.
DisplayResults($sString, $dBinary, $sConverted, "UTF8")
EndFunc ;==>Example
; Helper function which formats the message for display. It takes the following parameters:
; $sOriginal - The original string before conversions.
; $dBinary - The original string after it has been converted to binary.
; $sConverted- The string after it has been converted to binary and then back to a string.
; $sConversionType - A human friendly name for the encoding type used for the conversion.
Func DisplayResults($sOriginal, $dBinary, $sConverted, $sConversionType)
MsgBox($MB_SYSTEMMODAL, "", "Original:" & @CRLF & $sOriginal & @CRLF & @CRLF & "Binary:" & @CRLF & $dBinary & @CRLF & @CRLF & $sConversionType & ":" & @CRLF & $sConverted)
EndFunc ;==>DisplayResults
내용에 주석이 많기 때문에 주석을 잘 참고 하신다면 별도의 설명이 없이도 사용이 가능합니다. 그러므로 여기서는 해당 내용의 사용 방법에 대하여 짧게 설명드리고자 합니다.
먼저 첫번째 입력 값은 StringToBinary를 통해 변환되는데 한번 사용 되며, 그 후 DisplayResults에 결과 확인용으로 사용 됩니다. ( 하단 이미지 참고 )
두번째 값은 Binary로 선언된 변수에 StringToBinary 로 첫번째 글자를 변환한 값 입니다. 대화상자에서 중간에 영어와 숫자로 나타나는 값입니다.
마지막 값은 Binary값을 다시 String로 고쳐서 확인하는 값입니다. 첫번째 대화상자에서는 일부 한자가 손상되어 표시되는 것을 확인 할 수 있습니다.
Binary로 변환하는 작업은 RPA에서 다국어를 변활할때 유용한 기능입니다. 영문 OS등 다양한 OS 환경에서는 특정 언어가 정상적으로 표시되지 않는 경우가 있습니다. 예를들어 영문 OS 에서 한글을 INI 파일에 기록하면 글자가 손상되어 기록 됩니다. 이러한 경우를 막기위해 Binary로 변환하여 기록하고 다시 변환하여 사용 한다면 RPA 작업 시 보다 안정적으로 사용이 가능해 집니다.
현재 마우스 커서의 상태를 구하는 방법에 대하여 알아보겠습니다. 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에서 해당값을 사용하는 방법으로는 제품위에 마우스를 위치 시킨 후 마우스가 로딩중으로 표시되는 것은 아닌지 확인하는 방식으로 활용 가능합니다.
기본적인 마우스의 움직임을 조절하기 위해서는 MouseMove를 이용합니다. 원하는 위치로 이동시키기 위해서는 좌측값과 상단 값을 지정하여 이동하면됩니다.
MouseMove( 350 , 250 )
간단한 숫자를 입력 후 F5를 통해 동작을 확인하보면 모니터의 왼쪽 상단으로 마우스가 이동하는 것을 확인 할 수 있습니다.
마우스가 이동하는 시간을 절약하기 위해서는 뒤에 숫자를 1개 더 붙이면 됩니다.
MouseMove( 350 , 250 , 0 )
3번째 숫자의 기본값은 10 이며 0으로 설정할 경우 마우스가 순간이동하여 지정 된 위치로 이동되는 것을 확인 할 수 있습니다.
마우스 클릭을 위해서는 MouseClick 함수를 사용합니다. 이함수는 제일앞에 어떤 버튼을 클릭할지 입력한 후 MouseMove 함수와 동일하게 위치값을 입력하면 됩니다.
MouseClick("right", 350 , 250 )
클릭위치의 프로그램에서 마우스 우클릭을 통해 ContextMenu를 확인할때는 이렇게 입력하면 확인이 가능합니다.
당연히 마우스 움직임 속도를 설정하여 순간이동으로 클릭하도록 설정도 가능합니다. 하지만 마우스클릭의 경우 클릭수 를 먼저 설정해야 합니다. 1번 클릭할지 더블클릭할지 등 클릭수를 설정 후 마우스 이동속도를 설정할 수 있습니다. 더블클릭의 경우 우클릭보다는 좌클릭으로 대상을 선택하는 것이 좀더 효과를 확인하기 수월하므로 left 클릭으로 변경하고 편집기의 첫 명령어 위치를 클릭하도록 설정후 확인해 보겠습니다.
천천히 이동된 마우스가 MouseClick 함수를 더블클릭하여 편집기에서 해당함수가 선택 되는 것을 확인 할 수 있습니다. 이제 마우스 위치 치동 값을 0으로 설정하여 순간이동을 통해 함수가 선택되는 것을 확인해 보겠습니다.