#include #include #include Global $hMain = GUICreate("Recorder Example", 600, 400) Global $btnRecord = GUICtrlCreateButton("Start", 10, 10, 580, 25) Global $edtOutput = GUICtrlCreateEdit("", 10, 45, 580, 565) Global $bFlag = False Global $hUser32 = DllOpen("user32.dll") Global $sCurrentScript = "" Global $hBtnRecord = GUICtrlGetHandle($btnRecord) ShellExecute("Gui Example.exe", "", @ScriptDir & "\") Sleep(100) GUISetState(@SW_SHOW, $hMain) While (True) Switch (GUIGetMsg()) Case $GUI_EVENT_CLOSE DllClose($hUser32) Exit 0 Case $btnRecord $bFlag = Not $bFlag If ($bFlag) Then GUICtrlSetData($btnRecord, "Stop") Else GUICtrlSetData($btnRecord, "Start") GUICtrlSetData($edtOutput, $sCurrentScript) EndIf Case Else If (_IsPressed(01, $hUser32) and $bFlag) Then While (_IsPressed(01, $hUser32)) Sleep(10) WEnd Local $tPoint = _WinAPI_GetMousePos() Local $hControl = _WinAPI_WindowFromPoint($tPoint) Local $idControl = _WinAPI_GetDlgCtrlID($hControl) If ($hBtnRecord <> $hControl) Then $sCurrentScript &= 'ControlClick("' & WinGetTitle(_WinAPI_GetParent($hControl)) & '", "", ' & $idControl & ', "Left", 1)' & @CRLF EndIf $tPoint = Null EndIf EndSwitch WEnd