Leaderboard
Popular Content
Showing content with the highest reputation on 08/19/2022 in all areas
-
Good point @pixelsearch. By default any struct is filled with 0. And string must be ended with a null character. In you code, if you use a string larger than 50, the null char isn't there and it will continue searching for it, grabbing garbage characters along the way. So having a larger buffer will solve partly your problem. You must be careful since your variable is static. You need to make sure to add a null char at the end, otherwise you may end up with a different garbage issue.2 points
-
Garbage in Virtual ListView
Zedna and one other reacted to pixelsearch for a topic
This line seems to cause the issue : Local Static $tText = DllStructCreate("wchar[50]") Increasing the value seems to solve your problem.2 points -
I don't know if you are like me, but I am always searching for that specific code I wrote over the years, but cannot find it. It was way too exhausting to look at 1k+ scripts. And Windows Explorer is not the best tool to do such exploration. So I made this little script that save me tons of time. Hope you will find it useful too. You can adjust default search folders and type of files you want to search for, but you can also change it at runtime. To use multiple filters separate them with ";" Let me know if you have any suggestion to enhance the tool. Version 2023-12-27 * Code revision : 3.3.16.1 now required Version 2023-05-10 * Sets children flag on first drawn list Version 2021-04-06 * Context menu modified to allow clipping file name and line content Version 2020-11-21 * Allows only 1 running instance of the script * Added right-click support on Tray to exit script Version 2020-06-29 * Added Copy File Name to context menu (helps to copy include files names) Version 2020-04-22 * Added icons to main buttons * Added informative box to describe progress and results of a search * Increased robustness of the GUI * Open Button enabled only under the right conditions * Added Tooltip on filter field to describe how to enter multiple criteria * Forced a minimum Window size Version 2020-04-18 * Added support of Context Menu in Tree View * Added support of Tray * Minimizes on Tray Version 2020-04-12 * Added DPI awareness * Added Enter Key functionality to start a search Version 2020-04-09 * Changed base size of the GUI to make it wider * Made the window resizable * Added Reset button * Shown busy cursor more appropriately * Corrected bug of first line displayed Thanks all for your input. SearchContent.au31 point
-
Correct, $__XYZ from a standard UDF should never be used as that is considered an internally used variable, so can change. Like:https://www.autoitscript.com/trac/autoit/ticket/3860 ... but the correct info is FIle: RecoursesEx.au3 and line is 788. .. and the same needs to be done in RecoursesEx_PE.au3 Updated the initial post with a fixed zip file next to original one as @guinnessisn't around a lot these days.1 point
-
How are Radio Button Selections returned?
NYCmitch25 reacted to Jibberish for a topic
I am trying to get the results of a radio button selection. I have tried implementing sample scripts but to no avail. Can someone tell / show me what I am doing wrong? #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Local $bSelect1 Local $bSelect2 Local $bSelect3 SelectButton() ;The results of SelectButton is not being returned MsgBox(0,"","Select1 is "& $bSelect1 & ". Select2 is "& $bSelect2 & ". Select3 is "& $bSelect3 & ".") Func SelectButton() Local $hGUI = GUICreate("SGX4CP Tests", 300, 300) GUISetState() Local $bSelect1 = GUICtrlCreateRadio("Select 1", 10, 160) Local $bSelect2 = GUICtrlCreateRadio("Select 2", 10, 190) Local $bSelect3 = GUICtrlCreateRadio("Select 3", 10, 220) ; Set TestSelectForever as the default radio button GUICtrlSetState($bSelect1, $GUI_CHECKED) Local $idClose = GUICtrlCreateButton("Start", 120,250) Local $idMsg While 1 $idMsg = GUIGetMsg() Select Case $idMsg = $GUI_EVENT_CLOSE Or $idMsg = $idClose ExitLoop Case $idMsg = $bSelect1 And BitAND(GUICtrlRead($bSelect1), $GUI_CHECKED) = $GUI_CHECKED MsgBox(0,"","Select1") Case $idMsg = $bSelect2 And BitAND(GUICtrlRead($bSelect2), $GUI_CHECKED) = $GUI_CHECKED MsgBox(0,"","Select2") Case $idMsg = $bSelect3 And BitAND(GUICtrlRead($bSelect3), $GUI_CHECKED) = $GUI_CHECKED MsgBox(0,"","Select3") ; GUICtrlRead($hGUI) EndSelect WEnd MsgBox(0,"","Select1 is "& $bSelect1 & ". Select2 is "& $bSelect2 & ". Select3 is "& $bSelect3 & ".") ; Why is this returning numbers? EndFunc1 point -
How are Radio Button Selections returned?
NYCmitch25 reacted to Skeletor for a topic
Hi Jibberish, First I took your Start Button and wrapped an If Else Endif statement into it, to read the results of the Radio button. I've also cleaned your script up. Took away your function. No need to wrap it in a func. #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("SGX4CP Tests", 300, 300, 192, 124) $bSelect1 = GUICtrlCreateRadio("Select 1", 10, 160) $bSelect2 = GUICtrlCreateRadio("Select 2", 10, 190) $bSelect3 = GUICtrlCreateRadio("Select 3", 10, 220) $idClose = GUICtrlCreateButton("Start", 120, 250) GUISetState(@SW_SHOW) ; Set TestSelectForever as the default radio button GUICtrlSetState($bSelect1, $GUI_CHECKED) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $bSelect1 MsgBox(0, "", "Select1") Case $bSelect2 MsgBox(0, "", "Select2") Case $bSelect3 MsgBox(0, "", "Select3") Case $idClose $bSelect1 = GUICtrlRead($bSelect1) $bSelect2 = GUICtrlRead($bSelect2) $bSelect3 = GUICtrlRead($bSelect3) If $bSelect1 = 1 Then $Radio1 = String("checked") Else $Radio1 = String("not checked") EndIf If $bSelect2 = 1 Then $Radio2 = String("checked") Else $Radio2 = String("not checked") EndIf If $bSelect3 = 1 Then $Radio3 = String("checked") Else $Radio3 = String("not checked") EndIf MsgBox(0, "Results", "Select1 is " & $Radio1 & ". Select2 is " & $Radio2 & ". Select3 is " & $Radio3 & ".") ExitLoop EndSwitch WEnd1 point -
ZGorlock, Welcome to the AutoIt forum. Using Ascend4nt's code from post #35 you can get the selected items in string or array form like this: #include <Array.au3> Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ComErrFunc") $aWinList=WinList("[REGEXPCLASS:^(Explore|Cabinet)WClass$]") For $i = 1 To $aWinList[0][0] ; Get base folder and selections $aSelection = _ExplorerWinGetSelectedItems($aWinList[$i][1]) ; Display as strings ConsoleWrite("Explorer Window: " & $aSelection[1] & " Selection(s)" & @CRLF) For $j = 2 To $aSelection[0] + 1 ConsoleWrite(@TAB & $aSelection[$j] & @CRLF) Next ; Display as array _ArrayDisplay($aSelection, "Explorer Instance #" & $i & " / " & $aWinList[$i][0]) Next ; ========================================================================================================================== ; Func _ObjectSHFolderViewFromWin($hWnd) ; ; Returns an 'ShellFolderView' Object for the given Window handle ; ; Author: Ascend4nt, based on code by KaFu, klaus.s ; ========================================================================================================================== Func _ObjectSHFolderViewFromWin($hWnd) If Not IsHWnd($hWnd) Then Return SetError(1,0,0) Local $oShell,$oShellWindows,$oIEObject,$oSHFolderView ; Shell Object $oShell=ObjCreate("Shell.Application") If Not IsObj($oShell) Then Return SetError(2,0,0) ; Get a 'ShellWindows Collection' object $oShellWindows = $oShell.Windows() If Not IsObj($oShellWindows) Then Return SetError(3,0,0) ; Iterate through the collection - each of type 'InternetExplorer' Object For $oIEObject In $oShellWindows If $oIEObject.HWND = $hWnd Then ; InternetExplorer->Document = ShellFolderView object $oSHFolderView=$oIEObject.Document If IsObj($oSHFolderView) Then Return $oSHFolderView Return SetError(4,0,0) EndIf Next Return SetError(-1,0,0) EndFunc ; ========================================================================================================================== ; Func _ExplorerWinGetSelectedItems($hWnd) ; ; ; Author: klaus.s, KaFu, Ascend4nt (consolidation & cleanup, Path name simplification) ; ========================================================================================================================== Func _ExplorerWinGetSelectedItems($hWnd) If Not IsHWnd($hWnd) Then Return SetError(1,0,'') Local $oSHFolderView Local $iSelectedItems,$iCounter=2,$aSelectedItems[2] = [0, ""] $oSHFolderView=_ObjectSHFolderViewFromWin($hWnd) If @error Then Return SetError(@error,0,'') ; SelectedItems = FolderItems Collection object->Count $iSelectedItems = $oSHFolderView.SelectedItems.Count Dim $aSelectedItems[$iSelectedItems+2] ; 2 extra -> 1 for count [0], 1 for Folder Path [1] $aSelectedItems[0]=$iSelectedItems ; ShellFolderView->Folder->Self as 'FolderItem'->Path $aSelectedItems[1]=$oSHFolderView.Folder.Self.Path ; ShellFolderView->SelectedItems = FolderItems Collection object $oSelectedFolderItems = $oSHFolderView.SelectedItems #cs ; For ALL items in an Explorer window (not just the selected ones): $oSelectedFolderItems = $oSHFolderView.Folder.Items ReDim $aSelectedItems[$oSelectedFolderItems.Count+2] #ce For $oFolderItem In $oSelectedFolderItems $aSelectedItems[$iCounter] = $oFolderItem.Path $iCounter += 1 Next Return SetExtended($iCounter-2,$aSelectedItems) EndFunc ;==>_ExplorerWinGetSelectedItems Func _ComErrFunc($oError) ConsoleWrite("COM Error occurred:" & @CRLF & _ "Number: " & @TAB & $oError.number & @CRLF & _ "Windescription:" & @TAB & $oError.windescription & @CRLF & _ "Description is: " & @TAB & $oError.description & @CRLF & _ "Source is: " & @TAB & $oError.source & @CRLF & _ "Helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ "Helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ "Lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ "Scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ "Retcode is: " & @TAB & $oError.retcode & @CRLF & @CRLF) EndFunc ;==>_ComErrFunc M231 point