Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/06/2021 in all areas

  1. OH ! πŸ˜…Tanks are bit expensive and maybe dangerous... Thank (and no tanks...) you .. I will correct
    2 points
  2. Melba23

    HotKey to Button

    Bueno & Musashi, From the Help file: So they will not work in a minimized window. M23
    2 points
  3. JockoDundee, Read the explanation again. Mixed datatype comparisons are usually forced to numeric - and strings which do not start with numeric characters will then almost certainly be converted to 0. When it comes to Booleans things get a bit more complex - read the Help file datatypes page (particularly the <Boolean> section) to see how much. Composing that section took me a lot of time before I found a formulation which I hoped was understandable! No, because in this case the string is converted to a Boolean - the Help file page explains how it is done internally. However, I would much prefer: Local $str="ABC" If $str <> "" Then ... so that the string nature of both sides of the comparison is explicit. I am not even going to try - using Not without brackets to delimit the argument is always fraught with danger and can lead to all sorts of chaos.. Top Tip - do NOT mix datatypes in comparisons! M23
    2 points
  4. JockoDundee, The vital part of the "Operators" page in the Help file is further down than VIP's quote above: So your statement that both empty AND non-empty strings are converted to 0 is quite true - and why it is very inadvisable to mix datatyes in comparisons. M23
    2 points
  5. Maybe that’s the problem?
    2 points
  6. πŸ”« πŸ”« πŸ”« πŸ”« πŸš—πŸš—πŸš—πŸš— (Cars + squirt guns = Tanks) I think you meant thanks
    1 point
  7. Ok V.3.7.5 is out since some days, perfectable but ok for my basic needs, meanwhile I have the companion app to remote collect data about the machines, the way I'am doing this is a bit "convoluted..." but I have a particular network situation.. Btw, more high level details in this blog post And I am using the "about" from @Professor_Bernd .. Thank you !
    1 point
  8. hi, AutoIt allocate only for "str" parameter only 65536 bytes So the solution is Func _WinAPI_OemToChar_($sStr) Local $aCall, $sRetStr = "", $nLen = StringLen($sStr), $iLen = 1 While $iLen <= $nLen $aCall = DllCall('user32.dll', 'bool', 'OemToCharA', 'str', StringMid($sStr, $iLen, 65536), 'str', '') If @error Or Not $aCall[0] Then Return SetError(@error + 10, @extended, '') $sRetStr &= $aCall[2] $iLen += 65536 WEnd Return $sRetStr EndFunc ;==>_WinAPI_OemToChar I will fix it Not sure more _WinAPI_* functions need to do the same ... Cheers
    1 point
  9. Musashi

    HotKey to Button

    In advance : Shouldn't it be Global $aAccelKeys[2][2] = [["{F4}", $Start], ["{F8}", $Stop]] instead of Global $aAccelKeys[3][2] = [["F4", $Start], ["F8", $Stop]] I'm not 100% sure, but I think accelerators don't work with minimized windows πŸ€”.
    1 point
  10. mLipok

    7Zip

    I just check all files which was available here, collect them and post them to this download link/section: REMARK / WARNING: Some of them are little refactored. Each have add links to post and files. Only @Tlem version is changed. - 06-05-2021 updated by mLipok: * Added: _7Zip_GetDLLPath() * Refactored: _7ZipStartup() * Changed: _7ZipStartup() - If Not FileExists($s_DLL_path) And (Not FileInstall ..... * Changed: _7ZipStartup() - using @AutoItX64 instead of @OSArch - as DLL version is related not to OS but to program architecture * Changed: _7ZipShutdown() - Delete dll in temporary directory - not related to @compiled but to StringInStr($s_DLL_path, @TempDir) * Refactored: Examples Let me know if something goes wrong with this versions. EDIT: So far I have a problem with the FileInstall() function, which on the one hand I want to keep FileInstall() feature for compatibility with the current UDF, and on the other hand I do not want to use FileInstall() as the UDF should not force the user to do so. For example, I prefer to download missing files from HTTP. Work in progress.
    1 point
  11. @DAN what _WD_GetShadowRoot function do exactly ? Thanks
    1 point
  12. Func numRepititions($v = default) ; this is called a helper function If $v <> default Then $inival[20][21] = $v Return $inival[20][21] EndFunc
    1 point
  13. Yep. It's just the virtual number for the key. So you can differentiate "A" from "a", etc.
    1 point
  14. I was mistakenly assuming there was a full AutoIt beta release to go along with that one file.
    1 point
  15. Autoit Boolean values: True <> 0 AND non-empty Strings False = Empty string = Null = 0 _Comparison(True, 1) _Comparison(1, True) _Comparison(-1, True) _Comparison(0, True) _Comparison(5, True) _Comparison(1, 'A') _Comparison('A', True) _Comparison('DSFGSDFG', True) _Comparison('SDF', True) _Comparison(True, '') _Comparison(True, 'X') _Comparison('A', 'a') Func _Comparison($x, $y) If ($x == $y) Then ConsoleWrite("-1: " & $x & ' == ' & $y & @CRLF) Return 1 ElseIf ($x = $y) Then ConsoleWrite("-1: " & $x & ' = ' & $y & '' & @CRLF) Return -1 Else ConsoleWrite("-0: " & $x & ' <> ' & $y & @CRLF) Return 0 EndIf EndFunc ;==>_Compariso https://www.autoitscript.com/autoit3/docs/intro/lang_operators.htm
    1 point
  16. Thanks I ended up with: FileCreateShortcut( "C:\Windows\System32\cmd.exe",@desktopdir & "\Run.lnk" ,@DesktopDir,"/c start shell:::{2559a1f3-21d7-11d4-bdaf-00c04f60b9f0}","","%systemRoot%\system32\shell32.dll","",24,@SW_HIDE) The "why" was that I am dealing with a sysprep'd vm image where times the keyboard was not working initially so I wanted to have the run and CMD.exe icons as a quick backup option on the desktop. Thank you again.
    1 point
  17. Hi @FrancescoDiMuro Glad you enjoyed the precedent version "2g" of virtual listview + sort + incremental search Below will be my last version "2h" concerning this matter. Though these scripts are all related to Virtual listviews, they may take too much place in this thread (sorry LarsJ) . Also, the GUI is now completely filled ! This new version allows the user to search inside any column (using the combobox). An orange marker is displayed above the searched column header. The searched column is also constantly selected (until the user clicks any header, for sorting) #include <ComboConstants.au3> #include <EditConstants.au3> #include <GuiListView.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include "RandomArray.au3" ; LarsJ Opt("MustDeclareVars", 1) Global $g_iRows = 10000, $g_iCols = 6, $g_iLeftLV = 10, $g_iTopLV = 40, $g_hGui, $g_hListView, $g_hHeader, $g_hEdit Global $g_iSortDir, $g_idMarker, $g_idComboCol, $g_idComboColDummy, $g_idEditDummy, $g_iSearch = $g_iRows Global $g_aArray, $g_aSubArray, $g_tDefaultIndex, $g_tIndex = DllStructCreate("uint arr[" & $g_iRows & "]") Global $g_aIndex[$g_iCols], $g_aIndexTemp[$g_iCols] ; VarGetType's : $g_aIndex => "Array", $g_aIndex[0] => "String" Example() Func Example() ; Generate array & one index _Generate_All($g_aArray) $g_aSubArray = $g_aArray $g_tDefaultIndex = $g_tIndex ; Create GUI $g_hGui = GUICreate("Virtual ListView + Sort + Incremental search (2h)", 630 + 20, 788 + 30 + 20) ; Create Edit control (search) + dummy control Local $idEdit = GUICtrlCreateEdit("", 120, 10, 305, 20, BitXOR($GUI_SS_DEFAULT_EDIT, $WS_HSCROLL, $WS_VSCROLL)) $g_hEdit = GUICtrlGetHandle($idEdit) $g_idEditDummy = GUICtrlCreateDummy() ; Create ComboBox control (how to search : RegEx or Normal ?) Local $idSearchHow = GUICtrlCreateCombo("RegEx search", 11, 9, 100, 20, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_DROPDOWNLIST)) Local $sSearchHow = "RegEx search", $sSearchHowPrev = $sSearchHow ; default way of searching (changeable) GUICtrlSetData($idSearchHow, "Normal search", $sSearchHow) ; Create ComboBox control (column where to search) + dummy control GUICtrlCreateLabel("Col", 429, 10, 20, 20, BitOR($SS_CENTERIMAGE, $SS_CENTER)) $g_idComboCol = GUICtrlCreateCombo("0", 452, 9, 41, 20, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_DROPDOWNLIST)) Local $iSearchCol = 0, $iSearchColPrev = $iSearchCol ; default column where to search (changeable) For $i = 1 To $g_iCols - 1 GUICtrlSetData($g_idComboCol, $i & "|", $iSearchCol) Next $g_idComboColDummy = GUICtrlCreateDummy() ; Create Label control (number of matching results) Local $idResult = GUICtrlCreateLabel(" " & $g_iRows & " rows (no pattern)", 501, 10, 135, 20, BitOR($SS_CENTERIMAGE, $SS_SUNKEN)) ; Create ListView Local $idListView = GUICtrlCreateListView("", $g_iLeftLV, $g_iTopLV, 630, 788, $LVS_OWNERDATA, $WS_EX_CLIENTEDGE) _GUICtrlListView_SetExtendedListViewStyle($idListView, BitOr($LVS_EX_DOUBLEBUFFER, $LVS_EX_FULLROWSELECT)) $g_hListView = GUICtrlGetHandle($idListView) $g_hHeader = _GUICtrlListView_GetHeader($idListView) Local $aCols = ["Strings", "Integers", "Floats", "Dates", "Times", "R/C"] Local $aWidths = [230, 61, 124, 70, 60, 60] For $i = 0 To $g_iCols - 1 _GUICtrlListView_AddColumn($idListView, $aCols[$i], $aWidths[$i]) Next ; Create Marker (an orange line placed above the header of the column being searched) $g_idMarker = GUICtrlCreateLabel("", 0, 0) GUICtrlSetBkColor(-1, 0xFFA060) ; orange _MoveMarker($iSearchCol) _GUICtrlListView_SetSelectedColumn($g_hListView, $iSearchCol) ; Sorting information $g_iSortDir = 0x0400 ; $HDF_SORTUP Local $iSortCol = -1, $iSortColPrev = -1 GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUICtrlSendMsg($idListView, $LVM_SETITEMCOUNT, $g_iRows, 0) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $g_idComboCol, $g_idComboColDummy, $idSearchHow $iSearchCol = GUICtrlRead($g_idComboCol) $sSearchHow = GUICtrlRead($idSearchHow) Select Case $iSearchCol <> $iSearchColPrev _MoveMarker($iSearchCol) ; Search column will be selected below, after ContinueCase $iSearchColPrev = $iSearchCol Case $sSearchHow <> $sSearchHowPrev $sSearchHowPrev = $sSearchHow Case Else ; no change in both Combo controls (same search column, same search way) ContinueLoop EndSelect ContinueCase Case $g_idEditDummy _GUICtrlHeader_SetItemFormat($g_hHeader, $iSortCol, $HDF_STRING) Local $sSearch = GUICtrlRead($idEdit) $g_tIndex = $g_tDefaultIndex If $sSearch = "" Then ; Empty search string, display all rows $g_aSubArray = $g_aArray $g_iSearch = $g_iRows Else ; Find rows matching the search string $g_iSearch = 0 If $sSearchHow = "RegEx search" Then For $i = 0 To $g_iRows - 1 ; duplicated For... Next for speed If StringRegExp($g_aArray[$i][$iSearchCol], $sSearch) Then For $j = 0 To $g_iCols - 1 $g_aSubArray[$g_iSearch][$j] = $g_aArray[$i][$j] Next $g_iSearch += 1 EndIf Next Else ; "Normal search" For $i = 0 To $g_iRows - 1 ; duplicated For... Next for speed If StringInStr($g_aArray[$i][$iSearchCol], $sSearch) Then For $j = 0 To $g_iCols - 1 $g_aSubArray[$g_iSearch][$j] = $g_aArray[$i][$j] Next $g_iSearch += 1 EndIf Next EndIf ; Delete eventual temporary subindexes For $i = 0 To $g_iCols - 1 If VarGetType($g_aIndexTemp[$i]) = "DLLStruct" Then $g_aIndexTemp[$i] = "" ; "String" Next EndIf GUICtrlSetData($idResult, " " & $g_iSearch & ($sSearch = "" ? " rows (no pattern)" : " matching rows")) ;------ _GUICtrlListView_SetSelectedColumn($g_hListView, $iSearchCol) ; works fine ; _GUICtrlListView_SetSelectedColumn($idListView, $iSearchCol) ; strange behavior here ; GUICtrlSendMsg($idListView, $LVM_SETSELECTEDCOLUMN, $iSearchCol, 0) ; strange behavior here ;------ GUICtrlSendMsg($idListView, $LVM_SETITEMCOUNT, $g_iSearch, 0) Case $idListView ; Sort $iSortCol = GUICtrlGetState($idListView) If $iSortCol <> $iSortColPrev Then _GUICtrlHeader_SetItemFormat($g_hHeader, $iSortColPrev, $HDF_STRING) EndIf ; Set $g_tIndex + eventual update of $g_aIndexTemp[$iSortCol] OR $g_aIndex[$iSortCol] If GUICtrlRead($idEdit) Then _UpdateIndex($g_aIndexTemp, $iSortCol) Else _UpdateIndex($g_aIndex, $iSortCol) EndIf $g_iSortDir = (($iSortCol = $iSortColPrev) ? ($g_iSortDir = $HDF_SORTUP ? $HDF_SORTDOWN : $HDF_SORTUP) : ($HDF_SORTUP)) _GUICtrlHeader_SetItemFormat($g_hHeader, $iSortCol, $HDF_STRING + $g_iSortDir) GUICtrlSendMsg($idListView, $LVM_SETSELECTEDCOLUMN, $iSortCol, 0) GUICtrlSendMsg($idListView, $LVM_SETITEMCOUNT, $g_iSearch, 0) $iSortColPrev = $iSortCol Case $GUI_EVENT_RESTORE ; needed, or Marker goes back in 0, 0 after Restore (why ?) _MoveMarker($iSearchCol) EndSwitch WEnd ; Cleanup GUIDelete($g_hGui) EndFunc ;==>Example ;======================================================================== Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) Switch HWnd(DllStructGetData($tNMHDR, "hWndFrom")) Case $g_hListView Switch DllStructGetData($tNMHDR, "Code") Case $LVN_GETDISPINFOW Local $tNMLVDISPINFO = DllStructCreate($tagNMLVDISPINFO, $lParam) Local Static $tText = DllStructCreate("wchar[50]"), $pText = DllStructGetPtr($tText) If $g_iSortDir = 0x0400 Then ; 0x0400 = $HDF_SORTUP DllStructSetData($tText, 1, $g_aSubArray[$g_tIndex.arr($tNMLVDISPINFO.Item + 1)][$tNMLVDISPINFO.SubItem]) Else DllStructSetData($tText, 1, $g_aSubArray[$g_tIndex.arr($g_iSearch - $tNMLVDISPINFO.Item)][$tNMLVDISPINFO.SubItem]) EndIf DllStructSetData($tNMLVDISPINFO, "Text", $pText) EndSwitch Case $g_hHeader Switch DllStructGetData($tNMHDR, "Code") Case $HDN_ENDTRACKW, $HDN_DIVIDERDBLCLICKW ; let's forget $HDN_TRACKW... _MoveMarker(GUICtrlRead($g_idComboCol)) Case $NM_RCLICK Local $aHit = _GUICtrlListView_SubItemHitTest($g_hListView) ; $aHit[1] : 0-based index of the LV subitem... i.e. the column in our case (may be -1 if right click on empty part of header) If $aHit[1] > - 1 Then ; valid column GUICtrlSetData($g_idComboCol, $aHit[1]) GUICtrlSendToDummy($g_idComboColDummy) EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY ;======================================================================== Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $hWndFrom = $lParam Local $iCode = BitShift($wParam, 16) ; High word Switch $hWndFrom Case $g_hEdit Switch $iCode Case $EN_CHANGE GUICtrlSendToDummy($g_idEditDummy) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND ;======================================================================== Func _Generate_All(ByRef $g_aArray) ConsoleWrite("$g_iRows = " & $g_iRows & " $g_iCols = " & $g_iCols & @CRLF) Local $hTimer = TimerInit() $g_aArray = FAS_Random2DArrayAu3($g_iRows, "sifdtr", "abcdefghijklmnopqrstuvwxyz") For $i = 0 To $g_iRows - 1 $g_tIndex.arr($i + 1) = $i Next ConsoleWrite("Generating array & one index = " & TimerDiff($hTimer) & @CRLF & @CRLF) EndFunc ;==>_Generate_All ;======================================================================== Func _SortArrayStruct(Const ByRef $aArray, $iCol, $iRows) Local $tIndex = DllStructCreate("uint arr[" & $iRows & "]") Local $pIndex = DllStructGetPtr($tIndex) Local Static $hDll = DllOpen("kernel32.dll") Local Static $hDllComp = DllOpen("shlwapi.dll") Local $lo, $hi, $mi, $r ; Sorting by one column For $i = 1 To $iRows - 1 $lo = 0 $hi = $i - 1 Do $mi = Int(($lo + $hi) / 2) $r = DllCall($hDllComp, 'int', 'StrCmpLogicalW', 'wstr', $aArray[$i][$iCol], 'wstr', $aArray[DllStructGetData($tIndex, 1, $mi + 1)][$iCol])[0] Switch $r Case -1 $hi = $mi - 1 Case 1 $lo = $mi + 1 Case 0 ExitLoop EndSwitch Until $lo > $hi DllCall($hDll, "none", "RtlMoveMemory", "struct*", $pIndex + ($mi + 1) * 4, "struct*", $pIndex + $mi * 4, "ulong_ptr", ($i - $mi) * 4) DllStructSetData($tIndex, 1, $i, $mi + 1 + ($lo = $mi + 1)) Next Return $tIndex EndFunc ;==>_SortArrayStruct ;======================================================================== Func _UpdateIndex(ByRef $aIndex, $iCol) If VarGetType($aIndex[$iCol]) = "DLLStruct" Then $g_tIndex = $aIndex[$iCol] Else $g_tIndex = _SortArrayStruct($g_aSubArray, $iCol, $g_iSearch) $aIndex[$iCol] = $g_tIndex ; "DLLStruct" (or "Int32" when no match found +++) EndIf EndFunc ;==>_UpdateIndex ;======================================================================== Func _MoveMarker($iCol) Local $aRect = _GUICtrlHeader_GetItemRect($g_hHeader, $iCol) ControlMove($g_hGui, "", $g_idMarker, $g_iLeftLV + $aRect[0], $g_iTopLV - 3, $aRect[2] - $aRect[0] + 1, 3) EndFunc ;==>_MoveMarker Special thanks to LarsJ, Jpm, Melba23, Nine, mikell and many others, you were all inspiring for the evolution of this script. Update : May 06, 2021 * Added a 2nd way to quickly switch to a new search column : right click on its header ! * Added a GUI control allowing to switch from default RegEx search to a "normal" search (pic above) * Enlarged search field (interesting for long RegEx patterns) * LarsJ RandomArray.au3 + Random2DArray.txt attached below RandomArray.au3Random2DArray.txt
    1 point
  18. I believe that Jos meant to say version x.x.x.42 , but then again, may mean in the next upcoming release. lol, he was not joking, the beta now is 3.3.15.45 !. And does catch the event
    1 point
  19. Oh I see. When getting stream out of DOS console you will need to convert the string into non-DOS characters using _WinAPI_OemToChar ($sStream).
    1 point
  20. If you trying the get the position and size of a certain window, then use the method MIlesAhead stated, to find the screen pixel height and width use: @DeskTopHeight @DeskTopWidth
    1 point
×
×
  • Create New...