행위

"Autoit adlib"의 두 판 사이의 차이

DB CAFE

(Parameters)
 
66번째 줄: 66번째 줄:
 
EndFunc  ;==>MyAdLibFunc
 
EndFunc  ;==>MyAdLibFunc
 
</source>
 
</source>
 +
[[category:autoit]]

2024년 1월 2일 (화) 00:14 기준 최신판

thumb_up 추천메뉴 바로가기


1 autoit adlib 함수[편집]

1.1 AdlibRegister[편집]

  • Registers an Adlib function.
AdlibRegister ( "function" [, time = 250] )

1.1.1 Parameters[편집]

function The name of the adlib function to be registered. time [optional] how often in milliseconds to call the function. Default is 250 ms. Return Value Success: 1. Failure: 0.

1.1.2 Remarks[편집]

250ms(또는 시간 ms)마다 지정된 "함수"가 호출됩니다. 함수에 대한 첫 번째 호출은 지정된 기간 이후에 발생하며 함수가 즉시 등록되는 것은 아닙니다. 일반적으로 이 기능은 예상치 못한 오류를 확인하는 데 사용됩니다. 예를 들어, 오류 창이 예기치 않게 팝업되도록 하는 스크립트에서 adlib를 사용할 수 있습니다. adlib 함수는 자주 실행되고 이 시간 동안 기본 스크립트가 일시 중지되므로 단순하게 유지되어야 합니다. 또한 CPU 부하를 방지하려면 시간 매개변수를 주의해서 사용해야 합니다. 매개변수를 사용하여 함수를 등록할 수 없습니다.

여러 Adlib 함수를 등록할 수 있습니다. 기존 Adlib 기능을 다시 등록하면 새로운 시간으로 업데이트됩니다.


Every 250 ms (or time ms) the specified "function" is called - note that the first call to the function is after the specified time period and not immediately the function is registered. Typically the function is used to check for unforeseen errors. For example, you could use adlib in a script which causes an error window to pop up unpredictably. The adlib function should be kept simple as it is executed often and during this time the main script is paused. Also, the time parameter should be used carefully to avoid CPU load. You can not register a function using parameters.

Several Adlib functions can be registered. Re-registering an already existing Adlib function will update it with a new time.

1.1.3 Related[편집]

AdlibUnRegister

1.1.4 Example[편집]

#include <MsgBoxConstants.au3>

If ProcessExists("SciTE.exe") = 0 Then
        MsgBox($MB_SYSTEMMODAL, "", "You will need SciTE.exe to be running for ConsoleWrite to display.")
EndIf

Example()

Func Example()
        ; Register the function MyAdLibFunc() to be called every 250ms (default).
        AdlibRegister("MyAdLibFunc")

        ; Sleep does not stop AdLib functions from running.
        Sleep(1000)

        ; AdLib functions don't run while a blocking function is shown e.g. MsgBox, InputBox, WinWait, WinWaitClose etc.
        MsgBox($MB_SYSTEMMODAL, "", "No console message(s) will be shown whilst the messagebox is displayed.")

        ; The AdLib function MyAdLibFunc() will start again.
        Sleep(2000)

        ; Unregister the function MyAdLibFunc() from being called every 250ms.
        AdlibUnRegister("MyAdLibFunc")
EndFunc   ;==>Example

Func MyAdLibFunc()
        ; Assign a static variable to hold the number of times the function is called.
        Local Static $iCount = 0
        $iCount += 1

        ConsoleWrite("MyAdLibFunc called " & $iCount & " time(s)" & @CRLF)
EndFunc   ;==>MyAdLibFunc