Leaderboard
Popular Content
Showing content with the highest reputation on 04/01/2021 in all areas
-
Improving _ArrayDisplay speed
CYCho reacted to pixelsearch for a topic
Hi everybody when using _ArrayDisplay, I found a way to drastically reduce a listview load time (and later its sorting time when clicking on a column header) . We discussed of this a year ago with @jpm in this thread and I applied it to _ArrayDisplay just now. 1) The 1st script below uses the original functions of AutoIt It works on a 2D array of 10.000 rows & 10 columns (you may change that if you want) When you run this 1st script, the Console will indicate the number of seconds it takes to populate the listview. Please note this number somewhere so you'll compare it later with the 2nd script's number. #include <Array.au3> ; original #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> Opt("MustDeclareVars", 1) Global $hTimer Example() ;================================================== Func Example() _SplashOn("1 - Filling Array") Local $iRowMax = 10000, $iColMax = 10, $aArray[$iRowMax][$iColMax] For $i = 0 To $iRowMax - 1 For $j = 0 To $iColMax - 1 $aArray[$i][$j] = "Row " & $i & " / Col " & $j Next Next _ArrayShuffle($aArray) SplashOff() MsgBox($MB_TOPMOST, "Shuffled Array is ready", "Click to launch _ArrayDisplay original") _SplashOn("2 - Populating Listview") AdLibRegister(TimeToLoad) $hTimer = TimerInit() _ArrayDisplay($aArray, "Speed test ArrayDisplay Original") EndFunc ;==>Example ;================================================== Func TimeToLoad() ; Adlib If WinActive("Speed test ArrayDisplay Original") Then ConsoleWrite(TimerDiff($hTimer) / 1000 & @lf) AdLibUnRegister(TimeToLoad) SplashOff() EndIf EndFunc ;==>Slider ;================================================== Func _SplashOn($sFirstLine, $sSecondLine = "please wait...") SplashTextOn("", $sFirstLine & @CRLF & $sSecondLine, _ 250, 50, -1, -1, $DLG_NOTITLE + $DLG_TEXTVCENTER) EndFunc ;==>_SplashOn 2) The 2nd script below uses 2 "speed" files : ArrayDisplayInternals2.au3 and ArrayDisplayInternals_Fill.au3 You should notice that the listview appears much quicker and the Console should reflect it, maybe 2, 3 or 4 times faster. ; Array.au3 is not used during this speed test #include "ArrayDisplayInternals2.au3" ; increased speed (listview fill & sort) #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> Opt("MustDeclareVars", 1) Global $hTimer Example() ;================================================== Func Example() _SplashOn("1 - Filling Array") Local $iRowMax = 10000, $iColMax = 10, $aArray[$iRowMax][$iColMax] For $i = 0 To $iRowMax - 1 For $j = 0 To $iColMax - 1 $aArray[$i][$j] = "Row " & $i & " / Col " & $j Next Next _ArrayShuffle($aArray) SplashOff() MsgBox($MB_TOPMOST, "Shuffled Array is ready", "Click to launch _ArrayDisplay2") _SplashOn("2 - Populating Listview") AdLibRegister(TimeToLoad) $hTimer = TimerInit() _ArrayDisplay2($aArray, "Speed test ArrayDisplay2 Patched") EndFunc ;==>Example ;================================================== Func TimeToLoad() ; Adlib If WinActive("Speed test ArrayDisplay2 Patched") Then ConsoleWrite(TimerDiff($hTimer) / 1000 & @lf) AdLibUnRegister(TimeToLoad) SplashOff() EndIf EndFunc ;==>Slider ;================================================== Func _SplashOn($sFirstLine, $sSecondLine = "please wait...") SplashTextOn("", $sFirstLine & @CRLF & $sSecondLine, _ 250, 50, -1, -1, $DLG_NOTITLE + $DLG_TEXTVCENTER) EndFunc ;==>_SplashOn ; #FUNCTION# ==================================================================================================================== ; Author ........: randallc, Ultima ; Modified.......: Gary Frost (gafrost), Ultima, Zedna, jpm, Melba23, AZJIO, UEZ - _ArrayDisplay() renamed _ArrayDisplay2() in this speed test ; =============================================================================================================================== Func _ArrayDisplay2(Const ByRef $aArray, $sTitle = Default, $sArrayRange = Default, $iFlags = Default, $vUser_Separator = Default, $sHeader = Default, $iMax_ColWidth = Default) #forceref $vUser_Separator Local $iRet = __ArrayDisplay_Share($aArray, $sTitle, $sArrayRange, $iFlags, Default, $sHeader, $iMax_ColWidth, 0, False) Return SetError(@error, @extended, $iRet) EndFunc ;==>_ArrayDisplay2 ; #FUNCTION# ==================================================================================================================== ; Author ........: Melba23 ; Modified.......: copied here because Array.au3 is not used during this speed test ; =============================================================================================================================== Func _ArrayShuffle(ByRef $aArray, $iStart_Row = 0, $iEnd_Row = 0, $iCol = -1) ; Fisher–Yates algorithm If $iStart_Row = Default Then $iStart_Row = 0 If $iEnd_Row = Default Then $iEnd_Row = 0 If $iCol = Default Then $iCol = -1 If Not IsArray($aArray) Then Return SetError(1, 0, -1) Local $iDim_1 = UBound($aArray, $UBOUND_ROWS) If $iEnd_Row = 0 Then $iEnd_Row = $iDim_1 - 1 If $iStart_Row < 0 Or $iStart_Row > $iDim_1 - 1 Then Return SetError(3, 0, -1) If $iEnd_Row < 1 Or $iEnd_Row > $iDim_1 - 1 Then Return SetError(3, 0, -1) If $iStart_Row > $iEnd_Row Then Return SetError(4, 0, -1) Local $vTmp, $iRand Switch UBound($aArray, $UBOUND_DIMENSIONS) Case 1 For $i = $iEnd_Row To $iStart_Row + 1 Step -1 $iRand = Random($iStart_Row, $i, 1) $vTmp = $aArray[$i] $aArray[$i] = $aArray[$iRand] $aArray[$iRand] = $vTmp Next Return 1 Case 2 Local $iDim_2 = UBound($aArray, $UBOUND_COLUMNS) If $iCol < -1 Or $iCol > $iDim_2 - 1 Then Return SetError(5, 0, -1) Local $iCol_Start, $iCol_End If $iCol = -1 Then $iCol_Start = 0 $iCol_End = $iDim_2 - 1 Else $iCol_Start = $iCol $iCol_End = $iCol EndIf For $i = $iEnd_Row To $iStart_Row + 1 Step -1 $iRand = Random($iStart_Row, $i, 1) For $j = $iCol_Start To $iCol_End $vTmp = $aArray[$i][$j] $aArray[$i][$j] = $aArray[$iRand][$j] $aArray[$iRand][$j] = $vTmp Next Next Return 1 Case Else Return SetError(2, 0, -1) EndSwitch EndFunc ;==>_ArrayShuffle You may also notice that sorting on a column is much faster with the 2nd script, compared to the 1st script. Thanks for readers who intend to test this. Just place all 4 files in a folder (i.e. the 2 preceding scripts + ArrayDisplayInternals2.au3 + ArrayDisplayInternals_Fill.au3) . There is nothing to change in AutoIt folders. Please report if something went wrong or should be improved as I just ended this today. I already know that Global variable names which were added are perfectible, because they should follow the way ArrayDisplay "names" its variables, so they won't interfere with user's variables names. For the curious ones, the differences between the original file ArrayDisplayInternals.au3 and the "speed" file ArrayDisplayInternals2.au3 are found in 5 sections, delimited like this : ;********** Speed patch 1 start ********* ... ;********** Speed patch 1 end ********* Here are the 2 files to download : ArrayDisplayInternals2.au3 ArrayDisplayInternals_Fill.au31 point -
Hey there, thanks for the response. I had previously written my own logger with a GUI Edit window but it has a lot less features than yours does so I've switched to yours. But mine had WordWrap in it (I don't actually recall if I set it/enabled it or if it's just enabled by default on a GUICtrlCreateEdit control by default). Anyway, as to your settings, I can start your list for you, I've figured out most of them I think: Global $hLoga0 = _LogaNew() $iLogGuiW = 580 $iLogGuiH = 240 $sLogaFontSize = '9' ; set a universal font size $hLoga0.Name = 'Automation Log' $hLoga0.Format = ' {LevelName} {Message}' $hLoga0.FilePath = $sPathJob & '\' & 'Auto.log' $hLoga0.LogFileAutoFlush = False ; false makes it wipe log on each run $hLoga0.LogToFile = True $hLoga0.LogToGUI = True $hLoga0.Width = $iLogGuiW $hLoga0.Height = $iLogGuiH $hLoga0.Left = @DesktopWidth-$iLogGuiW-84 $hLoga0.Top = @DesktopHeight-$iLogGuiH-60 $hLoga0.GUIBkColor = '0x000000' $hLoga0.Trans = '230' $hLoga0.TraceFontColor = '0xfff0a7' $hLoga0.TraceFontSize = $sLogaFontSize $hLoga0.DebugFontColor = '0xffab64' $hLoga0.DebugFontSize = $sLogaFontSize $hLoga0.InfoFontColor = '0xd0d0d0' $hLoga0.InfoFontSize = $sLogaFontSize $hLoga0.WarnFontColor = '0x53b6ff' $hLoga0.WarnFontSize = $sLogaFontSize $hLoga0.ErrorFontColor = '0x4a22a8' $hLoga0.ErrorFontSize = $sLogaFontSize $hLoga0.FatalFontColor = '0x0000FF' $hLoga0.FatalFontSize = $sLogaFontSize _LogaRefreshSettings($hLoga0)1 point
-
Loga - A logging Library
Danyfirex reacted to Earthshine for a topic
No There is no way to display the console with word wrap that I know of and frankly I would never want to. I detest word wrap in most cases1 point -
_DateDiff Help file
argumentum reacted to TommyDDR for a topic
Hello, I'm working around _DateDiff and i saw a mistake in help file : Remarks Valid dates must be between "2000/01/01 00:00:00". and "3000/12/31 23:59:59" After testing : there is the min max : _DateDiff('s', "1000/01/01 00:00:00", "2999/12/31 23:59:59")1 point -
_DateDiff Help file
argumentum reacted to mLipok for a topic
Thanks for reporting. Already fixed in internal version ( SVN Commit #12346 ... date 10-10-2020 ) .1 point -
Based on your description, I would think you could do something like -- Use _IENavigate to load the webpage for a given user Use _IETableWriteToArray to retrieve the user data Write the desired contents to an Excel spreadsheet using the Excel UDF Rinse and repeat 😅 Another option would be to use InetRead to retrieve the raw HTML, but then you're back to parsing the contents manually. Can you tell us more about the website? Do they offer an API?1 point
-
Try this quick & dirty fix. Add this line Sleep(20*1000) after _IENavigate($oIE, $url). You need to do this at 2 places. If that solves your immediate problem, we can think of a better solution later.1 point
-
Hi @acam, Since you said you're an AutoIt newbie, I'm assuming that this is code written by someone else that you want to modify. Is that correct? Dan P1 point
-
Moved to the appropriate forum. Moderation Team1 point
-
Control Get Returning Blank
Musashi reacted to FrancescoDiMuro for a topic
@Animare That's because "UniForm" is the class of the Window, and the "text" parameter doesn't allow a classname. From the Help file about the "text" parameter: Window Text The window text consists of all the text that AutoIt can "see". This will usually be things like the contents of edit controls (as above with "This is some text!") but will also include other text like: Button text like &Yes, &No, &Next (the & indicates an underlined letter) Dialog text like "Are you sure you wish to continue?" Control text Misc text - sometimes you don't know what it is EDIT: Then, if you look in the Help file about ControlGetText() function, where do you see that "text" parameter wants a classname?1 point -
I had the same inssue and i decided make pixelsearch very small areas searching the same colors. That solved the problem of multiple computers.1 point
-
Use the counter to determine the row to copy: Local $oRange, $oTest Local $iStartLine = 0 ; First index of $aArray2 to process For $i = 0 To UBound($aArray2) - 1 If $i < $iStartLine Then ContinueLoop $oRange = $oWorkbook.ActiveSheet.Range("B" & $i + 1 & ":E" & $i + 1) $temprf &= $aArray2[$i] _Excel_RangeCopyPaste($oWorkbook.Activesheet, $oRange) $oTest = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "PasteButton") ;This button will paste values from the Clipboard once clicked _WD_ElementAction($sSession, $oTest, 'click')) Next In addition I have Moved the Local definition out of the loop Replaced $Skipline with $iStartLine because your code only skipped a single line, not all lines up to the specified line1 point
-
Grosminet, I have never used that message for detecting thumb movement on a slider - I always use $SB_THUMBTRACK via a $WM_H/VSCROLL message like this: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> $hGUI = GUICreate("Test", 500, 500) $cSlider = GUICtrlCreateSlider(10, 10, 200, 20) $hSlider = GUICtrlGetHandle($cSlider) GUISetState() GUIRegisterMsg($WM_HSCROLL, "_WM_HSCROLL") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WM_HSCROLL($hWnd, $iMsg, $wParam, $lParam) If $lParam = $hSlider Then If _WinAPI_LoWord($wParam) = 5 Then ;$SB_THUMBTRACK ConsoleWrite(GUICtrlRead($cSlider) & " - " & @MSEC & @CRLF) EndIf EndIf Return $GUI_RUNDEFMSG EndFunc M231 point
-
How to open url with default browser?
behdadsoft reacted to Skruge for a topic
ShellExecute("http://www.google.com")1 point