Leaderboard
Popular Content
Showing content with the highest reputation on 12/21/2019 in all areas
-
Just check if it is outside boundaries. $ipText = DllStructGetData($tInfo, "Index") < 0 ? "" : $IPlist[DllStructGetData($tInfo, "Index")][1]1 point
-
You forgot to show the actual error message, but assume it's something with subscripts&array meaning that the returned value of DllStructGetData($tInfo, "Index") is no a correct one that exists in the array. Jos1 point
-
@Danp2, with your help I have written a code that updates ChromeDriver.exe and WebDriver UDF files. In my Windows 10 computer, I created a task that is scheduled to run every hour about 5 minutes after GoogleUpdate is run. So far it works fine. Please take a look at the UDF part and you may have a say. This will help anyone who uses ChromeDriver regularly. #include <Inet.au3> #include <String.au3> #include "wd_core.au3" #cs ; commented out as per @Danp2's opinion ( https://www.autoitscript.com/forum/topic/191990-webdriver-udf-w3c-compliant-version-12132019/page/29/?tab=comments#comment-1443580 ) $sGithubSource = _INetGetSource("https://github.com/Danp2/WebDriver/releases/latest") $aLatestWDVersion = StringRegExp($sGithubSource, '<a href="/Danp2/WebDriver/releases/tag/(.*)">', 1) $sLatestWDVersion = $aLatestWDVersion[0] $sCurrentWDVersion = $__WDVERSION ; Const declared in wd_core.au3 If $sLatestWDVersion <> $sCurrentWDVersion Then $sZipFile = @ScriptDir & "\WebDriver-" & $sLatestWDVersion & ".zip" $iSize = InetGet("https://github.com/Danp2/WebDriver/archive/" & $sLatestWDVersion & ".zip", $sZipFile, $INET_FORCERELOAD, $INET_DOWNLOADWAIT) If $iSize > 0 Then $sDriverPath = @ScriptDir $oShell = ObjCreate ("Shell.Application") $FilesInZip = $oShell.NameSpace($sZipFile & "\WebDriver-" & $sLatestWDVersion).items $oShell.NameSpace($sDriverPath).CopyHere($FilesInZip, 20) ; 4 - Do not display a progress dialog box, 16 - Click "Yes to All" in any dialog box displayed ConsoleWrite("WebDriver was upgraded to version " & $sLatestWDVersion & @CRLF) EndIf Else ConsoleWrite("Current WebDriver UDF is the latest version!" & @CRLF) EndIf #ce $sPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe", "") If @error Then Exit $sChromeVersion = FileGetVersion($sPath) ConsoleWrite("Chrome version - " & $sChromeVersion & @CRLF) $iPID = Run(@ScriptDir & "\chromedriver.exe --version", @ScriptDir, @SW_HIDE, $STDOUT_CHILD) ProcessWaitClose($iPID) $sOutput = StdoutRead($iPID) $aResult = _StringBetween($sOutput, "ChromeDriver ", " (") $sChromeDriver = @error ? "Not installed" : $aResult[0] ; Ternary operator ConsoleWrite("Chromedriver version -- " & $sChromeDriver & @CRLF) $sChromeVersionShort = StringLeft($sChromeVersion, StringInStr($sChromeVersion, ".", 0, -1) - 1) $sChromeDriverLatest = _INetGetSource("https://chromedriver.storage.googleapis.com/LATEST_RELEASE_" & $sChromeVersionShort) ConsoleWrite("Chromedriver latest -- " & $sChromeDriverLatest & @CRLF) If $sChromeDriver = $sChromeDriverLatest Then ConsoleWrite("ChromeDriver upgrade not needed!" & @CRLF) Exit EndIf FileMove(@ScriptDir & "\chromedriver_win32.zip", @ScriptDir & "\chromedriver_win32_old.zip", $FC_OVERWRITE) $sZipFile = @ScriptDir & "\chromedriver_win32.zip" $iSize = InetGet("https://chromedriver.storage.googleapis.com/" & $sChromeDriverLatest & "/chromedriver_win32.zip", $sZipFile, $INET_FORCERELOAD, $INET_DOWNLOADWAIT) ;https://chromedriver.storage.googleapis.com/78.0.3904.70/chromedriver_win32.zip If $iSize > 0 Then FileMove(@ScriptDir & "\chromedriver.exe", @ScriptDir & "\chromedriver_old.exe", $FC_OVERWRITE) $sDriverPath = @ScriptDir $oShell = ObjCreate ("Shell.Application") $FilesInZip = $oShell.NameSpace($sZipFile).items $oShell.NameSpace($sDriverPath).CopyHere($FilesInZip, 4) ; 4 - Do not display a progress dialog box, 16 - Click "Yes to All" in any dialog box displayed ConsoleWrite("Chromedriver was upgraded to version " & $sChromeDriverLatest & @CRLF) Else FileMove(@ScriptDir & "\chromedriver_win32_old.zip", @ScriptDir & "\chromedriver_win32.zip", $FC_OVERWRITE) ConsoleWrite("Download of chromedriver zip file failed" & @CRLF) EndIf1 point
-
Listview sort column 0 (numbers) column 1 (strings)
pixelsearch reacted to LarsJ for a topic
You should not unregister/register the sort function after every sort. Only when you sort by another column. This is the code in post 2: #include <GuiListView.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <StructureConstants.au3> Opt('MustDeclareVars', 1) Global $search_LV, $B_DESCENDING GUICreate("ListView Sort by Column Click", 400, 300) $search_LV = GUICtrlCreateListView("String|Number|String", 2, 2, 394, 268) GUICtrlSendMsg($search_LV, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($search_LV, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) GUICtrlCreateListViewItem("line4|5|1A", $search_LV) GUICtrlCreateListViewItem("line5|4.50 |1B", $search_LV) GUICtrlCreateListViewItem("line5|4.0 |2C", $search_LV) GUICtrlCreateListViewItem("line3|23|01", $search_LV) GUICtrlCreateListViewItem("line2|0.34560 |09", $search_LV) GUICtrlCreateListViewItem("line1|1.0 |7A", $search_LV) GUICtrlCreateListViewItem("line1|0.1 |8C", $search_LV) GUICtrlCreateListViewItem("line1|97|5B", $search_LV) GUICtrlCreateListViewItem("line1|910|9B", $search_LV) GUICtrlCreateListViewItem("line1|99|11", $search_LV) GUICtrlCreateListViewItem("line1|990.99|06", $search_LV) _GUICtrlListView_SetColumnWidth($search_LV, 0, 75) _GUICtrlListView_SetColumnWidth($search_LV, 1, 75) _GUICtrlListView_SetColumnWidth($search_LV, 2, 75) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") ;~ _GUICtrlListView_RegisterSortCallBack($search_LV, False) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $search_LV ; Kick off the sort callback ;~ _GUICtrlListView_SortItems($search_LV, GUICtrlGetState($search_LV)) ;~ _GUICtrlListView_UnRegisterSortCallBack($search_LV) EndSwitch WEnd Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) Local Static $ColumnSortedPrev = -1 #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo $hWndListView = $search_LV ;~ If Not IsHWnd($search_LV) Then $hWndListView = GUICtrlGetHandle($search_LV) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom ;~ Case $search_LV Case GUICtrlGetHandle($search_LV) Switch $iCode Case $LVN_COLUMNCLICK ; A column was clicked ConsoleWrite("Header geklickt" & @CRLF) Local $tInfo = DllStructCreate($tagNMLISTVIEW, $iLparam) Local $ColumnSorted = DllStructGetData($tInfo, 'SubItem') If $ColumnSortedPrev <> $ColumnSorted Then If $ColumnSortedPrev > -1 Then _GUICtrlListView_UnRegisterSortCallBack($search_LV) If $ColumnSorted = 1 Then ConsoleWrite('Numeric: ' & _GUICtrlListView_RegisterSortCallBack($search_LV, True) & @CRLF) Else ConsoleWrite('Literal: ' & _GUICtrlListView_RegisterSortCallBack($search_LV, False) & @CRLF) EndIf $ColumnSortedPrev = $ColumnSorted EndIf _GUICtrlListView_SortItems($search_LV, DllStructGetData($tInfo, 'SubItem')) EndSwitch EndSwitch EndFunc ;==>WM_NOTIFY1 point -
AutoIt exe - from exe to rainmeter - Looking for pointers
Code-Sapient reacted to Jos for a topic
I still have no clue what you are talking about: Decompiling .net stuff to get the dll's used? rainmeter ? (assume this is not something that measures rainfall) I see this is your second thread on more or less the same topic and the other one also didn't get much response which in general means things aren't clear and won't be able to assist in anyway, shape or form. So again: try to be col=mplete in providing information about what you want to know and be clear in what the question is. Jos0 points -
AutoIt exe - from exe to rainmeter - Looking for pointers
Code-Sapient reacted to Jos for a topic
You description doesn't offer much base to make any suggestion. Try to be a little more descriptive what it is you actually want to accomplish. Jos0 points