Chú thích : Nhấn ESC (1B) để dừng ghi và phát lại
1.Thư viện
MouseCap.au3
#include-once
#include <Misc.au3>
#include <Array.au3>
DllOpen('user32.dll')
Func _Mouse_Capture($BreakKey,$fDelay)
Local $_fDown[2] = [0, 0]
Local $_Return
While 1
If _IsPressed($BreakKey) then ExitLoop
$_GetPos = MouseGetPos()
$_Return &= 'MouseMove('&$_GetPos[0]&','&$_GetPos[1]&',1)' &@CR
If _IsPressed("01") Then
If $_fDown[0] = 0 Then
$_Return &= 'MouseDown("left")' &@CR
$_fDown[0] = 1
EndIf
Else
If $_fDown[0] = 1 Then
$_Return &= 'MouseUp("left")' &@CR
$_fDown[0] = 0
EndIf
EndIf
If _IsPressed("02") Then
If $_fDown[1] = 0 Then
$_Return &= 'MouseDown("right")' &@CR
$_fDown[1] = 1
EndIf
Else
If $_fDown[1] = 1 Then
$_Return &= 'MouseUp("right")' &@CR
$_fDown[1] = 0
EndIf
EndIf
Sleep($fDelay)
Wend
$_Return = StringSplit($_Return,@CR)
_ArrayDelete($_Return,0)
_ArrayDelete($_Return,Ubound($_Return)-1)
Return $_Return
EndFunc
Func _Mouse_Play($Record)
For $Execute in $Record
Execute($Execute)
Next
EndFunc
2.Demo :
*Include Countdown GUI.au3
#include <guiconstantsex.au3>
#include <Windowsconstants.au3>
#include <WINAPI.au3>
#include <Constants.au3>
Local $countdown = 3, $freq = 500
Local $gui = GUICreate("", 700, 700, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST))
GUISetBkColor(0xABCDEF)
Local $lbl = GUICtrlCreateLabel('', 140, 10, 680, 680)
GUICtrlSetColor(-1, 0xff0000)
GUICtrlSetFont($lbl, 400, 800)
_WinAPI_SetLayeredWindowAttributes($gui, 0xABCDEF, 250)
_WinAPI_SetWindowLong($gui, $GWL_EXSTYLE, BitOR(_WinAPI_GetWindowLong($gui, $GWL_EXSTYLE), $WS_EX_TRANSPARENT))
GUISetState(@SW_SHOW)
For $i = $countdown To 1 Step -1
GUICtrlSetData($lbl, $i)
;Beep($freq, 500)
Sleep(1000)
Next
GUIDelete($gui)
Demo.au3
#include "MouseCap.au3"
#include "Countdown GUI.au3"
$Var = _Mouse_Capture("1B",10)
_ArrayDisplay($Var)
_Mouse_Play($Var)