Leaderboard
Popular Content
Showing content with the highest reputation on 03/21/2021 in all areas
-
Replace Strings from Another Txt File - (Moved)
pixelsearch and one other reacted to Melba23 for a topic
Hi, Using _ArrayDelete with either a range string or an array means that you get multiple deletions with only a single ReDim call - and as everyone (I hope) knows that is the real bottleneck in any array manipulation code. Delighted to see that my hard work to update the function a while back is appreciated - even if it has taken this long for the improvement to be noticed! M232 points -
Yes : #include <Constants.au3> #include <WindowsConstants.au3> #include <StructureConstants.au3> #include <WinAPISysWin.au3> #include <APISysConstants.au3> Opt("MustDeclareVars", 1) HotKeySet("{ESC}", _Exit) Example() Func Example() Local $hWnd, $tPoint = DllStructCreate($tagPOINT) Local $hTarget, $sClass, $sClassList, $iInstance, $hCtrl While 1 $tPoint.X = MouseGetPos(0) $tPoint.Y = MouseGetPos(1) $hTarget = _WinAPI_WindowFromPoint($tPoint) $sClass = _WinAPI_GetClassName($hTarget) $hWnd = _WinAPI_GetAncestor($hTarget, $GA_ROOT) ConsoleWrite($hWnd & "/" & $hTarget & "/" & $sClass) If $hWnd <> $hTarget And $sClass <> "" Then $sClassList = WinGetClassList($hWnd) StringReplace($sClassList, $sClass, $sClass) $iInstance = @extended ConsoleWrite("(" & $iInstance & ") ") For $i = 1 To $iInstance $hCtrl = ControlGetHandle($hWnd, "", $sClass & $i) If $hCtrl = $hTarget Then ConsoleWrite(" [CLASS:" & $sClass & "; INSTANCE:" & $i & "]") ExitLoop EndIf Next EndIf ConsoleWrite(@CRLF) Sleep(500) WEnd EndFunc ;==>Example Func _Exit() Exit EndFunc ;==>_Exit2 points
-
Replace Strings from Another Txt File - (Moved)
Musashi and one other reacted to pixelsearch for a topic
Hi all A few days ago I experimented successfully for the 1st time the instruction _ArrayDelete() when its 2nd parameter is an Array and it worked fast & nicely on an Array containing 1000 rows. For example, in OP's need, it could be done like this (Array names are Musashi's) _ArraySort($aDataArr) ; ascending, required for coming _ArrayBinarySearch() For $i = 1 To $aDeleteArr[0] ; [0] = number of rows in array $aDeleteArr $idx = _ArrayBinarySearch($aDataArr, $aDeleteArr[$i]) ; extremely fast (+++) If $idx = -1 Then Exit MsgBox(0, "", "_ArrayBinarySearch failed") $aDeleteArr[$i] = $idx Next _ArrayDelete($aDataArr, $aDeleteArr) ; delete using a 1D array with a count in the [0] element (at last !) Of course there is the problem of "If $idx = -1" that could never happen in my own script (where the user selected several existing rows to be deleted after pressing the Del Key) but I still wanted to share this idea with you Just tried it again on a 2000 rows source file and 100 rows to be deleted, it was very fast.2 points -
Hi to all, I only am accustomed pas has posted on the forum (coz, I'm french). But I use it a lot. So first of all, thank you all to participate in the evolution of this wonderful product. Today is not one day like any other, I myself am decide has posted a UDF that I myself create and developed (there may be some bug) for some months. So here it is: This UDF allows to use the SSH protocol very easily in your code. It uses the syntax as the TCPxxx() function. Your code will be easier to convert :-). excused my English, I'm French. Example: #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.4.0 Author: Joseph Barone 2010-2015 Script Function: Modele pour l'utilisation de la fonction ssh (plink). #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include #include #include #include #include #include "SSH_udf.au3" _SSHStartup() Global $butt[6] $Gui = GUICreate("SSH Console",550,400) $label1 = GUICtrlCreateLabel("Adresse IP:",10,10,150,20) ; ip $input1 = GUICtrlCreateInput("",10,25,150,20) ; ip $label2 = GUICtrlCreateLabel("Tcp port:",170,10,150,20) ; port $input2 = GUICtrlCreateInput("",170,25,60,20) ; port $label6 = GUICtrlCreateLabel("Protocol:",240,10,40,20) ; port $input6 = GUICtrlCreateInput("ssh",240,25,60,20) ; port $butt[0] = GUICtrlCreateButton("Connect0",310,5,80,20,$BS_DEFPUSHBUTTON) $butt[1] = GUICtrlCreateButton("Connect1",390,5,80,20) $butt[2] = GUICtrlCreateButton("Connect2",470,5,80,20) $butt[3] = GUICtrlCreateButton("Connect3",310,25,80,20) $butt[4] = GUICtrlCreateButton("Connect4",390,25,80,20) $butt[5] = GUICtrlCreateButton("Connect5",470,25,80,20) $Checkbox = GUICtrlCreateCheckbox("RSA, Fingerprint, Alert AutoValidate", 330, 45, 205, 25) $label4 = GUICtrlCreateLabel("Login:",10,45,150,20) ; login $input4 = GUICtrlCreateInput("",10,60,150,20) ; login $label5 = GUICtrlCreateLabel("Mot de passe:",170,45,150,20) ; password $input5 = GUICtrlCreateInput("",170,60,150,20,$ES_PASSWORD) ; password $label3 = GUICtrlCreateLabel("Commande a envoyer:",10,85,150,20) ; send command $input3 = GUICtrlCreateInput("",10,100,310,20) ; send commande vers l'hote $butt2 = GUICtrlCreateButton("Send",330,100,80,20,$BS_DEFPUSHBUTTON) GUICtrlSetState($butt2,$GUI_DISABLE) $edit = GUICtrlCreateEdit("",10,130,530,260,$WS_VSCROLL);,$WS_DISABLED)) GUISetState() Global $ConnectedSocket[6] = [-1,-1,-1,-1,-1,-1] Global $msg, $recv, $ret ; GUI Message Loop ;============================================== While 1 $nmsg = GUIGetMsg() If $nmsg = $GUI_EVENT_CLOSE Then ExitLoop ;;; connect part: $b = 0 While 1 If $nMsg = $butt[$b] Then If GUICtrlRead($butt[$b]) = "Connect"&$b Then _SSHParametreSet("yesall",GUICtrlRead($Checkbox)) _SSHParametreSet("protocol",GUICtrlRead($input6)) _SSHParametreSet("login",GUICtrlRead($input4)) _SSHParametreSet("passwd",GUICtrlRead($input5)) $ConnectedSocket[$b] = _SSHConnect(GUICtrlRead($input1),GUICtrlRead($input2)) If $ConnectedSocket[$b] = 0 Then MsgBox(0,"Erreur", "Impossible de ce connecter!!") Else GUICtrlSetData($butt[$b],"Close"&$b GUICtrlSetState($butt2,$GUI_ENABLE) EndIf DisplayArray($_config) ConsoleWrite("nb config:"&$_nbconf&@CRLF) Else _SSHCloseSocket($ConnectedSocket[$b]) GUICtrlSetData($butt[$b],"Connect"&$b GUICtrlSetState($butt2,$GUI_DISABLE) DisplayArray($_config) ConsoleWrite("nb config:"&$_nbconf&@CRLF) EndIf EndIf ;;; send part: If $nMsg = $butt2 Then $ret = _SSHSend( $ConnectedSocket[$b] , GUICtrlRead($input3)&@crlf) GUICtrlSetData($input3,"") GUICtrlSetState($input3,$GUI_FOCUS) EndIf ;;; receive part: $recv = _SSHRecv( $ConnectedSocket[$b]) If $recv <> "" Then GUICtrlSetData($edit, GUICtrlRead($edit) & $recv ) EndIf GUICtrlSendMsg($edit, $EM_SCROLL, $SB_PAGEDOWN, 0) $b += 1 If $b = UBound($butt) Then ExitLoop WEnd WEnd _SSHCloseSocket($ConnectedSocket) _SSHShutdown() Exit Func DisplayArray($array) $i = 0 $j = 0 if UBound($array,1) = 0 Then Return While 1 ConsoleWrite("(["&UBound($array,1)&"]["&UBound($array,2)&"]) ") While 1 ConsoleWrite("["&$j&"]"&$array[$i][$j]&" ") $j += 1 if UBound($array,2)<=$j Then ExitLoop WEnd ConsoleWrite(@CRLF) $i += 1 $j = 0 if UBound($array,1)<=$i Then ExitLoop WEnd EndFunc I join with UDF version of modified putty myself. 🙂 LoL but, it is not used with the UDF, it is included in the UDF. putty-04012015- 92453+lic.zip ssh_udf.zip New version (contains the latest version of plink (0.74) edited by http://jakub.kotrla.net/putty/) ssh_udf-v2.zip Same as the v2 but supports all putty/plink settings ssh_udf-v2.1.zip1 point
-
Let me review my previous post. After playing with it, I noticed that it was not able to detect disabled controls. So here a new version : #include <Constants.au3> #include <WindowsConstants.au3> #include <StructureConstants.au3> #include <WinAPISysWin.au3> #include <APISysConstants.au3> #include <WinAPIConv.au3> Opt("MustDeclareVars", 1) HotKeySet("{ESC}", _Exit) Example() Func Example() Local $hWnd, $tPoint = DllStructCreate($tagPOINT) Local $hTarget, $sClass, $sClassList, $iInstance, $hCtrl While 1 $tPoint.X = MouseGetPos(0) $tPoint.Y = MouseGetPos(1) $hTarget = _WinAPI_WindowFromPoint($tPoint) $hWnd = _WinAPI_GetAncestor($hTarget, $GA_ROOT) If $hTarget = $hWnd Then _WinAPI_ScreenToClient($hWnd, $tPoint) $hTarget = _WinAPI_ChildWindowFromPointEx ($hWnd, $tPOINT) EndIf $sClass = _WinAPI_GetClassName($hTarget) ConsoleWrite ($hWnd & "/" & $hTarget & "/" & $sClass) If $hWnd <> $hTarget And $sClass <> "" Then $sClassList = WinGetClassList($hWnd) StringReplace($sClassList, $sClass, $sClass) $iInstance = @extended ConsoleWrite ("(" & $iInstance & ") ") For $i = 1 To $iInstance $hCtrl = ControlGetHandle($hWnd, "", $sClass & $i) If $hCtrl = $hTarget Then ConsoleWrite (" [CLASS:" & $sClass & "; INSTANCE:" & $i & "]") ExitLoop EndIf Next EndIf ConsoleWrite (@CRLF) Sleep(500) WEnd EndFunc ;==>Example Func _Exit() Exit EndFunc ;==>_Exit I could have modified the previous post, but I thought you would prefer a new snippet so you can compare and study the changes made.1 point
-
Replace Strings from Another Txt File - (Moved)
pixelsearch reacted to jugador for a topic
Local $o_File1 = 'M211 S0;' & @CRLF & _ 'G90;' & @CRLF & _ 'G01 X12.8356Y4.2664' & @CRLF & _ 'G01 X12.8404Y4.2176' & @CRLF & _ 'G04 P500;' & @CRLF & _ 'G1 F60' & @CRLF & _ 'G00 Z2.0000' & @CRLF & _ 'G00 X8.5161Y8.8562' & @CRLF & _ 'G01 Z-0.0700' & @CRLF & _ 'G01 X12.8350Y4.5373' & @CRLF & _ 'G01 X12.8350Y4.2909' & @CRLF & _ 'G01 X12.8500Y4.1694' & @CRLF & _ 'G01 X12.8642Y4.1225' & @CRLF & _ 'G01 X12.8830Y4.0771' Local $o_File2 = 'M211 S0;' & @CRLF & _ 'G90;' & @CRLF & _ 'G04 P500' & @CRLF & _ 'G1 F60' Local $0_Pattern = StringReplace($o_File2, @CRLF, "$|^") $0_Pattern = '(?m)^' & $0_Pattern & '$' Local $0_Output = StringRegExpReplace($o_File1, $0_pattern, "") local $0_Space = "(?m)^[\s]+" $0_Output = StringRegExpReplace($0_Output, $0_Space, "") MsgBox(0, "", $0_Output)1 point -
Replace Strings from Another Txt File - (Moved)
pixelsearch reacted to Musashi for a topic
First of all : I really like this approach, thanks for sharing . In this particular case, however, some problems are occurring : It does not work, if $aDeleteArr contains a vValue that does not exist in the $aDataArr (@error=3 , as described in the help, so the error message is ok ). This is the case here, because the OP probably made a typo : DeleteArr = G04 P500 -> DataArr = G04 P500; (after fixing this typo - @ahmetpi : you have to fix this as well !) : Instead of $idx = _ArrayBinarySearch($aDataArr, $aDeleteArr[$i]) , I had to use $idx = _ArrayBinarySearch($aDataArr, $aDeleteArr[$i], 1). If there are several identical entries (here : G90;) only the first one will be removed. However, this was not an original request by the OP, I just added these data for testing purposes (so it can be ignored). Other users should pay attention to it, though. Here is the new combined script : (the lines with ; *** Musashi : just for testing are for control reasons only and can be removed) #include <File.au3> #include <Array.au3> Global $aDataArr, $aDeleteArr _FileReadToArray(@ScriptDir & "\DataArr.txt", $aDataArr) _FileReadToArray(@ScriptDir & "\DeleteArr.txt", $aDeleteArr) _ArraySort($aDataArr) ; ascending, required for coming _ArrayBinarySearch() For $i = 1 To $aDeleteArr[0] ; [0] = number of rows in array $aDeleteArr ConsoleWrite(" ==> $i=" & $i & " vValue=" & $aDeleteArr[$i] & @CRLF) ; *** Musashi : just for testing $idx = _ArrayBinarySearch($aDataArr, $aDeleteArr[$i], 1) ; extremely fast (+++) ConsoleWrite(" ----> Error=" & @error & " $idx=" & $idx & " vValue=" & $aDeleteArr[$i] & @CRLF) ; *** Musashi : just for testing If $idx = -1 Then Exit MsgBox(0, "", "_ArrayBinarySearch failed") $aDeleteArr[$i] = $idx Next _ArrayDelete($aDataArr, $aDeleteArr) ; delete using a 1D array with a count in the [0] element (at last !) _ArrayDisplay($aDataArr, "Cleared Array :") ; *** Musashi : just for testing Yes, one has to really make sure that "reliable data" are available .1 point -
dmob, I have slightly modified _GUIExtender_EventMonitor which now only returns 1 when a section has been actioned and sets @extended to the section index. So now you can determine when a section has been actioned and close all the others: GUIExtender_Mod.au3 And here is an example to test it: #include <GUIConstantsEx.au3> #include "GUIExtender_Mod.au3" $hGUI = GUICreate("Test", 500, 690) _GUIExtender_Init($hGUI) $iSection_1 = _GUIExtender_Section_Create($hGUI, 0, 30) $iY_1 = _GUIExtender_Section_BaseCoord($hGUI, $iSection_1) _GUIExtender_Section_Activate($hGUI, $iSection_1 + 1, "", "", 0, $iY_1, 20, 20) GUICtrlCreateLabel("First Section Header", 30, $iY_1, 200, 20) $iSection_2 = _GUIExtender_Section_Create($hGUI, -1, 200) $iY_2 = _GUIExtender_Section_BaseCoord($hGUI, $iSection_2) GUICtrlCreateLabel("First Section Text", 10, $iY_2 + 10, 100, 100) GUICtrlSetBkColor(-1, 0xFFCCCC) $iSection_3 = _GUIExtender_Section_Create($hGUI, -1, 30) $iY_3 = _GUIExtender_Section_BaseCoord($hGUI, $iSection_3) _GUIExtender_Section_Activate($hGUI, $iSection_3 + 1, "", "", 0, $iY_3, 20, 20) GUICtrlCreateLabel("Second Section Header", 30, $iY_3, 200, 20) $iSection_4 = _GUIExtender_Section_Create($hGUI, -1, 200) $iY_4 = _GUIExtender_Section_BaseCoord($hGUI, $iSection_4) GUICtrlCreateLabel("Second Section Text", 10, $iY_4 + 10, 100, 100) GUICtrlSetBkColor(-1, 0xCCFFCC) $iSection_5 = _GUIExtender_Section_Create($hGUI, -1, 30) $iY_5 = _GUIExtender_Section_BaseCoord($hGUI, $iSection_5) _GUIExtender_Section_Activate($hGUI, $iSection_5 + 1, "", "", 0, $iY_5, 20, 20) GUICtrlCreateLabel("Third Section Header", 30, $iY_5, 200, 20) $iSection_6 = _GUIExtender_Section_Create($hGUI, -1, 200) $iY_6 = _GUIExtender_Section_BaseCoord($hGUI, $iSection_6) GUICtrlCreateLabel("Third Section Text", 10, $iY_6 + 10, 100, 100) GUICtrlSetBkColor(-1, 0xCCCCFF) _GUIExtender_Section_Create($hGUI, -99) _GUIExtender_Section_Action($hGUI, 0, 0) GUISetState() While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[0] Case $GUI_EVENT_CLOSE Exit EndSwitch ; Check for click on section action control If _GUIExtender_EventMonitor($aMsg[1], $aMsg[0]) = 1 Then ; Action took place $iLastAction = @extended ; Section actioned ; Now run through the sections For $i = $iSection_2 To $iSection_6 Step 2 ; Do nothing to the actioned sections If $i <> $iLastAction Then ; But retract all the others _GUIExtender_Section_Action($hGUI, $i, 0) EndIf Next EndIf WEnd Does that solve your problem? M23 Edit: I have just realised that this is not a complete solution - so still a bit of work to do.1 point
-
Replace Strings from Another Txt File - (Moved)
Musashi reacted to FrancescoDiMuro for a topic
@ahmetpi For the fun Non-compact version: Compact version: P.S.: you were missing a ; after the "G04 P500" line in your replacement file (as @Musashi already pointed you out)1 point -
File update/overwrite
jugador reacted to pixelsearch for a topic
I'd go with @JockoDundee on that one, though we may be both wrong ! OP certainly checked the file content after he ran his 2 examples, so Overwrite seems to be what he needs. Maybe another software will continuously read the content of this "bridge" file to get real-time data and process it ? @jugador : I'd go with Method2 (which opens the file only once) and tested two scripts below : * 1st script (writing) to be run from Explorer ; 1) Writing script : run from Explorer Sleep(3000) ; delay to enter Scite and Run the other script (reading script) Local Const $sFilePath = @ScriptDir & "\abcd.txt" Local $hFileOpen = FileOpen($sFilePath, 2) ; Write mode (erase previous contents) Local $i = 0 Local $hTimer = TimerInit(), $fDiff While 1 $i += 1 FileSetPos($hFileOpen, 0, 0) FileWrite($hFileOpen, $i) FileSetEnd($hFileOpen) ; mandatory, so next Write will erase totally a preceding value $fDiff = TimerDiff($hTimer) If $fDiff > 10000 Then ExitLoop ; 10s Sleep(10) WEnd FileClose($hFileOpen) ConsoleWrite(TimerDiff($hTimer) / 1000 & @lf) * 2nd script (reading) to be run from Scite during the 3 seconds delay (Sleep 3000) ; 2) Reading script : run from Scite (just after Writing script was run from Explorer) Local Const $sFilePath = @ScriptDir & "\abcd.txt" Local $hFileOpen = FileOpen($sFilePath) ; Read mode (default) Local $hTimer = TimerInit(), $fDiff While 1 FileSetPos($hFileOpen, 0, 0) $sFileRead = FileRead($hFileOpen) If @error Then Exit MsgBox(0, "Read Error", "") $fDiff = TimerDiff($hTimer) If $fDiff > 10000 Then ExitLoop ; 10s ConsoleWrite($sFileRead & " " & $fDiff / 1000 & @lf) Sleep(10) WEnd FileClose($hFileOpen) ConsoleWrite(TimerDiff($hTimer) / 1000 & @lf) Console excerpt, choosing a part where a value is doubled (211) and another one is missing (214) ... 209 1.68841933821198 210 1.70512732763522 211 1.7157971194663 211 1.72742513364129 212 1.73909896369511 213 1.75097673028276 215 1.76267095398996 216 1.77430427610213 ... I'm not sure if FileFlush() is needed after each write operation (it could slow down the whole process) but maybe other readers will give their opinion about that (to read the most accurate value from the file in real time) Anyway, the task manager didn't show anything special while both scripts were running, minimal CPU charge and memory usage. Edit: FileSetEnd() seems important when writing, this is what happens with it or without it : With FileSetEnd, correct result if we write "a" when $i = 501, then "a" will be read ... 500 7.30425794339783 a 7.31545936704246 a 7.32574000326857 a 7.34107211950122 Without FileSetEnd, incorrect result if we write "a" when $i = 501 ("a" overwrites the "5", reading will return "a00") ... 500 5.33945850659791 a00 5.35076692708151 a00 5.3613953728756 a00 5.372145621859761 point -
mike2003, Certainly: #include <GUIConstantsEx.au3> Global $aColours[3] = [0xFF0000, 0x00FF00, 0x0000FF] $iCount = 0 $hGUI = GUICreate("Test", 500, 500) $cLabel = GUICtrlCreateLabel("", 8, 8, 84, 34) GUICtrlSetState($cLabel, $GUI_DISABLE) $cButton = GUICtrlCreateButton("Press Me!", 10, 10, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton $iCount +=1 GUICtrlSetBkColor($cLabel, $aColours[Mod($iCount, 3)]) EndSwitch WEnd M231 point
-
Acro.au3 UDF
GMK reacted to seadoggie01 for a topic
@GMK I'd suggest two things: 1. Try your code... PdDoc.GetInfo doesn't accept two parameters and _Acro_DocSetInfo doesn't return True if there's not an error 2. I'd likely combine these into a single function: _Acro_DocInfo($oPdDoc, $sInfoKey, $sValue = Default)... which calls .GetInfo if $sValue = Default or .SetInfo if not1 point -
Windows Message Monitor
GicuPiticu reacted to LarsJ for a topic
In a Windows GUI like an AutoIt GUI, functionality and user actions are largely controlled through Windows messages. Therefore, it's interesting to monitor Windows messages. That's the purpose of this example. How does it work? This is a simple example (Examples\1) Native controls\GUICtrlCreateButton.au3): #include <GUIConstantsEx.au3> #include "..\..\Includes\WinMsgMon_Button.au3" ; <<<<<<<<<<<<<<<<<<<< WinMsgMon_InitMsgs( "..\..\Includes" ) ; <<<<<<<<<<<<<<<<<<<< Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example", 300, 200) WinMsgMon_GetMsgs( $hGUI, "$hGUI" ) ; <<<<<<<<<<<<<<<<<<<< ; Create button controls. Local $idMsgBox = GUICtrlCreateButton("Open MsgBox", 120, 170, 85, 25) WinMsgMon_GetMsgs( $idMsgBox, "$idMsgBox" ) ; <<<<<<<<<<<<<<<<<<<< Local $idClose = GUICtrlCreateButton("Close", 210, 170, 85, 25) WinMsgMon_GetMsgs( $idClose, "$idClose" ) ; <<<<<<<<<<<<<<<<<<<< ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $idMsgBox WinMsgMon_UserMsg( $idMsgBox, $WM_USER0, _ ; <<<<<<<<<<<<<<<<<<<< "Before MsgBox" ) MsgBox( 0, "Title", "One second timeout", 1 ) WinMsgMon_UserMsg( $idMsgBox, $WM_USER1, _ ; <<<<<<<<<<<<<<<<<<<< "After MsgBox" ) Case $GUI_EVENT_CLOSE, $idClose WinMsgMon_UserMsg( $idClose, $WM_USER0, _ ; <<<<<<<<<<<<<<<<<<<< "Before ExitLoop" ) ExitLoop EndSwitch WEnd ; Delete GUI and all controls. GUIDelete($hGUI) WinMsgMon_ViewMsgs( Example ) ; <<<<<<<<<<<<<<<<<<<< EndFunc ;==>Example Include UDF In this example WinMsgMon UDF is included as WinMsgMon_Button.au3 and not just WinMsgMon.au3. Because this is a button example, WinMsgMon_Button.au3 is included to be able to get detail information about button messages. WinMsgMon_InitMsgs() WinMsgMon_InitMsgs() is called immediately after inclusion of the UDF. The function sets up the path used to find text files with message information. In addition to the path, WinMsgMon_InitMsgs() can take an optional $iFlags parameter as input. See WinMsgMon.au3 and Rerun in Toolbar buttons section for more information. WinMsgMon_GetMsgs() WinMsgMon_GetMsgs() is the central function that collects messages. It takes two parameters: A window or control and optionally the name of the window or control. In the example above the function is called three times to be able to collect messages sent to the main GUI and two buttons. While messages are collected and stored, info is simultaneously written to SciTE console. The specified window or control names are used in console output and in WinMsgMon GUI. If no names are specified, the names Window1, Button1 and Button2 are used instead. WinMsgMon_UserMsg() WinMsgMon_UserMsg() sends user messages to the two buttons. 16 user messages are defined: $WM_USER0 - $WM_USERF. In the example $WM_USER0 and $WM_USER1 are send to $idMsgBox button before and after the MsgBox is opened and closed. And $WM_USER0 is send to $idClose button immediately before ExitLoop. This way it's easy to recognize the button clicks among the messages. WinMsgMon_ViewMsgs() WinMsgMon_ViewMsgs() is the central function that displays the messages in WinMsgMon GUI. In the example WinMsgMon_ViewMsgs() is called with Example function as parameter. The function parameter is optional and is used in relation to the Rerun button to be able to run Example once more. See Rerun in Toolbar buttons section. WinMsgMon_ViewMsgs() is called as the last line in Example() function. It does not necessarily have to be the last line. But it must definitely be after GUIDelete(). WinMsgMon_ViewMsgs() may well be called before a final long term calculation or file update. In simple situations you may have sufficient information in SciTE console output. In such cases you can omit the WinMsgMon_ViewMsgs() function. GUI window This is a small part of the messages generated by the example above as shown in WinMsgMon GUI: First column in main listview is message number. Note that the message number in first and second row is 220 and 225. This is because some messages eg. WM_MOUSEMOVE are unchecked in WM_MESSAGEs toolbar listview and therefore not displayed in main listview. Second column shows the window or control that receives the message. Name of idMsgBox button, of interest here, is written on a wheat colored background. Message column shows WM_MESSAGEs and control messages. Some messages are particularly interesting. They are written on a colored background. Notification column displays notifications contained in WM_NOTIFY and WM_COMMAND messages. The info columns shows information provided along with the messages. Console output The same messages as shown in SciTE console (long lines shortened): [ 220] idMsgBox WM_PAINT [ 221] idMsgBox WM_NCHITTEST [ 222] idMsgBox WM_SETCURSOR [ 223] hGUI WM_SETCURSOR [ 224] idMsgBox WM_MOUSEMOVE [ 225] hGUI WM_NOTIFY BCN_HOTITEMCHANGE From = idMsgBox HICF_ENTERING [ 226] idMsgBox WM_PAINT [ 227] idMsgBox WM_ERASEBKGND [ 228] hGUI WM_ERASEBKGND [ 229] hGUI WM_CTLCOLORDLG [ 230] hGUI WM_PRINTCLIENT [ 231] hGUI WM_CTLCOLORBTN [ 232] hGUI WM_NOTIFY NM_CUSTOMDRAW From = idMsgBox CDDS_PREERASE [ 233] hGUI WM_NOTIFY NM_CUSTOMDRAW From = idMsgBox CDDS_PREPAINT [ 234] idMsgBox WM_GETTEXTLENGTH [ 235] idMsgBox WM_GETTEXT [ 236] idMsgBox WM_USER1 [ 237] idMsgBox WM_PAINT Toolbar listviews The five toolbar buttons before the first separator opens five listviews. The buttons are hot-track enabled with the technique used in this example. Wins/Ctrls In Wins/Ctrls listview you check the window or control where from you want to see messages. Here messages from all windows and controls are shown: Because some messages eg. WM_MOUSEMOVE are unchecked only 742 of 1315 messages are shown. Click the checkmark or select the row and press Space key to show all messages. When a row is checked, main listview is updated instantly. Unchecked messages in other toolbar listviews are reset. See Set in Toolbar buttons section for an easy way to uncheck messages. Click the color cell or select the row and press Enter key to set background color. The combo control is implemented with the technique demonstrated in this example. The background color for all windows and controls (first row) cannot be set. Note that only single selection is enabled in this toolbar listview. In the other four listviews multiple selections are enabled. To close a toolbar listview click in main listview, click the toolbar button, move mouse pointer above titlebar or press Esc. WM_MESSAGEs In WM_MESSAGEs listview you uncheck messages that you don't want to see. WM_MOUSEMOVE and WM_NCHITTEST messages are already unchecked. WM_NOTIFY messages are written on an aquamarine background: To uncheck or set background color for all WM_NC-messages select the six rows and press Space or Enter key. When a message is un- or in-checked nothing happens until the listview is closed. Then the Refresh button is enabled. Before you click the Refresh button you can un- or in-check messages in other listviews. Click Refresh button to update main listview. When a color is set main listview is updated instantly. Control Msgs The Control Msgs listview is used to manage control messages: WM_0xC09B is an application defined and unregistered message and is shown as the message code. The two user messages are written on a tomato red background. WM_NOTIFYs and WM_COMMANDs WM_NOTIFYs and WM_COMMANDs listviews are used to manage notifications contained in WM_NOTIFY and WM_COMMAND messages. Toolbar listviews 2 - 5 Messages and notifications in toolbar listviews 2 - 5 are grouped by checked/unchecked items. Unchecked items in bottom of listviews. Update 2018-08-15. A Search can be initiated by double-clicking a message or notification in toolbar listviews 2 - 5. Update 2018-08-04. Toolbar buttons Click Refresh to update main listview after messages and notifications are un- or in-checked in toolbar listviews. Click Rerun to run the script and perform message collection once more. A submenu shows up with "Rerun script", "Write messages to console" and "Detail message information" items. The two last items are the same options as can be set through flag values in WinMsgMon_InitMsgs(). In the example in top of post WinMsgMon_ViewMsgs() takes Example as an input parameter. This is the function that will be executed when you click "Rerun script". The function parameter is optional. If not specified, Rerun button is disabled. The Search group is used to search for messages and notifications. When you click the Search button the Search listview shows up. Double click or press Enter key on an item in the listview to start a search. A search for WM_USER1 messages looks this way in main listview: Use Reset button to reset a search. A search can also be initiated by double-clicking a message or notification in toolbar listviews 2 - 5. Update 2018-08-04. Copy button copies text in selected rows to clipboard. Set button applies settings defined in WinMsgMon.ini. See below. A submenu shows up with Uncheck and Colors items. Click Uncheck to uncheck messages defined in ini-file. Colors are already set through GUI creation. Reset shows a submenu with Uncheck, Colors and Search items. Click an item to reset the feature. Use Set button to apply the feature again. Code info A few notes about the code in relation to toolbar listviews and buttons. All listviews are virtual listviews. Through message collection, indexes are created to display data in main listview and to perform searches. Several set of indexes are created. A set for all windows and controls at once. And a set for each single window and control. When a row in Wins/Ctrls toolbar listview (the leftmost listview) is checked, messages are displayed in main listview through one of these precalculated indexes. That's the reason why it's possible to display the messages in the same moment as the row is checked. Search indexes are created for each single message and notification in the Search listview. A set for all windows and controls at once. And a set for each single window and control. That's a lot of search indexes. In the example above, there are around 100 - 150 search indexes. Calculation of indexes is performed through dictionary objects. When you perform a search the matching rows in main listview are instantly drawn with the yellow background color through a precalculated search index. Next and Prev buttons also takes advantage of the indexes. As soon as a message or notification is unchecked in toolbar listviews 2 - 5 none of these precalculated indexes can be used any more. When you click Refresh a new index is calculated to be able to display the messages in main listview. When you start a search a new index is calculated to be able to display matching messages with the yellow background color, and to be able to use Next and Prev buttons. Up to 10,000 messages, performance should not be a problem. So far, no more messages have been tested. Arrays are dimensioned to a maximum of 100,000 messages. The number of windows and controls in leftmost toolbar listview is limited to 20. When you check an item in leftmost toolbar listview all unchecked messages and notifications are reset and the precalculated indexes can be used again. Functions Most functions have already been described through review of the example in top of post. There are only a few left: WinMsgMon_LoadMsgs() When the message flow from an application is monitored, usually only messages for a single control and main GUI is monitored at a time. However, there will nevertheless often be messages from eg. buttons that are very common controls. If button messages are not registered with WinMsgMon_GetMsgs( $idButton ), messages will appear with the code instead of the name. It's actually the notifications that will appear with the code instead of the name. Use WinMsgMon_LoadMsgs() to load notification names this way: #include "..\..\Includes\WinMsgMon.au3" WinMsgMon_InitMsgs( "..\..\Includes" ) WinMsgMon_LoadMsgs( "BCN_Notifications.txt" ) ; Button control notifications WinMsgMon_LoadMsgs( "EN_Notifications.txt" ) ; Edit control notifications WinMsgMon_RemMsgs() WinMsgMon_RemMsgs() removes all message monitors registered with WinMsgMon_GetMsgs(). WinMsgMon_RemMsgs() is called as the first command in WinMsgMon_ViewMsgs(). It's only necessary to call WinMsgMon_RemMsgs() if WinMsgMon_ViewMsg() isn't called. Ie. if the messages are written to SciTE console only. And only if code is executed after GUIDelete(). Detail info Detail info is information in columns named Info 1 - 4 in WinMsgMon GUI. This is information that can be extracted through wParam and lParam parameters in a message handler function. Detail info for WM_NOTIFY and WM_COMMAND messages is always extracted. Detail info for other window and control messages is depending on specific message handlers (script files). In this version only a few message handlers are implemented and only for a limited number of messages. To be able to collect detail info the message handler must be included in the script. In the example in top of post WinMsgMon_Button.au3 is included instead of WinMsgMon.au3 to be able to collect detail info for buttons. WinMsgMon.ini Includes\WinMsgMon.ini is included in the zip-file. If a copy of this file is placed in the same folder as the running script, the copy will be used instead. You can edit the copy to your own needs. An empty file disables all settings in Includes\WinMsgMon.ini. Includes\WinMsgMon.ini: [Apply Settings] Uncheck=True Colors=True [WM_MESSAGEs Uncheck] WM_ERASEBKGND=1 WM_IME_NOTIFY=1 WM_MOUSEMOVE=1 WM_MOVE=1 WM_MOVING=1 WM_NCHITTEST=1 WM_NCMOUSEMOVE=1 WM_PAINT=1 WM_PRINTCLIENT=1 WM_SETCURSOR=1 WM_TIMER=1 WM_WINDOWPOSCHANGED=1 WM_WINDOWPOSCHANGING=1 [WM_MESSAGEs Colors] WM_NOTIFY=Aquamarine WM_COMMAND=Aquamarine WM_KEYDOWN=Bisque WM_KEYUP=Bisque WM_CHAR=Bisque WM_DEADCHAR=Bisque WM_SYSKEYDOWN=Bisque WM_SYSKEYUP=Bisque WM_SYSCHAR=Bisque WM_SYSDEADCHAR=Bisque WM_LBUTTONDOWN=Khaki WM_LBUTTONUP=Khaki WM_LBUTTONDBLCLK=Khaki WM_RBUTTONDOWN=Khaki WM_RBUTTONUP=Khaki WM_RBUTTONDBLCLK=Khaki WM_MBUTTONDOWN=Khaki WM_MBUTTONUP=Khaki WM_MBUTTONDBLCLK=Khaki WM_MOUSEWHEEL=Khaki WM_XBUTTONDOWN=Khaki WM_XBUTTONUP=Khaki WM_XBUTTONDBLCLK=Khaki WM_CONTEXTMENU=LightPink WM_INITMENU=LightPink WM_INITMENUPOPUP=LightPink WM_MENUSELECT=LightPink WM_MENUCHAR=LightPink WM_MENURBUTTONUP=LightPink WM_MENUGETOBJECT=LightPink WM_UNINITMENUPOPUP=LightPink WM_MENUCOMMAND=LightPink WM_ENTERMENULOOP=LightPink WM_EXITMENULOOP=LightPink WM_NEXTMENU=LightPink [Control Messages Uncheck] [Control Messages Colors] WM_USER0=Tomato WM_USER1=Tomato WM_USER2=Tomato WM_USER3=Tomato WM_USER4=Tomato WM_USER5=Tomato WM_USER6=Tomato WM_USER7=Tomato WM_USER8=Tomato WM_USER9=Tomato WM_USERA=Tomato WM_USERB=Tomato WM_USERC=Tomato WM_USERD=Tomato WM_USERE=Tomato WM_USERF=Tomato [WM_NOTIFY Notifications Uncheck] [WM_NOTIFY Notifications Colors] [WM_COMMAND Notifications Uncheck] [WM_COMMAND Notifications Colors] "Uncheck=True" in "Apply Settings" section in WinMsgMon.ini means that unchecked messages are removed from main listview through GUI creation. As soon as an item in Wins/Ctrls toolbar listview (leftmost) is checked the removed messages are redisplayed. Click Set | Uncheck to remove the messages again. "Colors=True" in "Apply Settings" section means that colors are set through GUI creation. Examples Examples\ 1) Native controls - GUICtrlCreate<Control> examples supplied with message monitor code 2) UDF controls - _GUICtrl<Control>_Create examples (not included above) supplied with message monitor code 3) Miscellaneous Combo\ - ComboBox example including the corresponding Edit and ListBox controls. ListView\ - Four ListView examples with a standard ListView, a custom drawn ListView, a virtual ListView and a virtual and custom drawn ListView. Window\ - An example that shows how mouse clicks generates AutoIt messages ($GUI_EVENT_MESSAGEs). Two examples regarding blocked and paused GUIs. Includes Includes\ WinMsgMon.au3 - Main include file, collects messages WinMsgMon_Button.au3 - Button controls, detail information WinMsgMon_ComboBoxEx.au3 - ComboBoxEx controls, detail information WinMsgMon_ListBox.au3 - ListBox controls, detail information WinMsgMon_ListView.au3 - ListView controls, detail information WinMsgMon.ini - ini-file, colors and unchecked messages Internal\ - Internal files, implements the GUI Messages\ - Message info files CTRL_Information.txt - Info file for AutoIt window and 23 controls WM_Messages.txt - Common Windows messages CCM_Messages.txt - Common control messages <???>_Messages.txt - Messages for specific controls WM_NOTIFY\ NM_Notifications.txt - Common Windows notifications <???>_Notifications.txt - WM_NOTIFY notifications for specific controls WM_COMMAND\ <???>_Notifications.txt - WM_COMMAND notifications for specific controls 7z-file The 7z contains source code and message data. You need AutoIt 3.3.12 or later. Tested on Windows 7 and Windows 10. Comments are welcome. Let me know if there are any issues. WinMsgMon.7z1 point