Jump to content

All Activity

This stream auto-updates     

  1. Past hour
  2. Hi, first of all thanks to all the guys who always help people in the forums, I wouldn't be able to do anything if wasn't for your help, even if I don't ask it myself. I've created this code to get some info on a monitoring network on my work. It relays on _IETableGetCollection and _IETableWriteToArray. It works well, but take around 3:25 minutes to get the info from 28 pages (some of them are large and take longer to load, but most of them are small and fast). My question is if you see a way to get the program to go faster... I've tried to make it easy for you to understand and edited somethings with sensitive info. (Some of the pages doesn't have the black divider with MIRA in the end, so I need to search if it is there or not.) #include <IE.au3> #include <array.au3> Local $oIE = _IECreate("about:blank", 0, 0) Local $paginas[28] = [89, 90, 91, 92, 93, 96, 105, 113, 119, 125, 126, 129, 131, 133, 135, 137, 139, 140, 141, 144, 145, 146, 148, 149, 150, 151, 158, 159] Local $Datos_array[0][2] Local $oTable Local $tabla Local $aux_x = 1 Local $ar = 1 Local $Numtables_datos = 0 MsgBox(0, "asd", "asd") For $pag = 0 To UBound($paginas) - 1 Step 1 _IENavigate($oIE, "<WEBSITE URL>" & $paginas[$pag]) ; <<< the pages to load are always the same except for the last digits. _ArrayAdd($Datos_array, $paginas[$pag] & "|" & "Entrante", 0, "|") ; <<<<<<<<<<<<<<<< adds the page number toarray [0, 0] ;############################################ START counts amount of tables with traffic $oTable = _IETableGetCollection($oIE) Local $iNumTables = @extended For $i = 3 To $iNumTables - 2 Step 1 $oTable = _IETableGetCollection($oIE, $i) $nomb_tabla2 = _IETableWriteToArray($oTable) ; <<<<<<<< TABLE TO ARRAY. $string2 = StringStripWS($nomb_tabla2[1][0], 8) If $string2 <> "MIRA" Then $Numtables_datos = $Numtables_datos + 1 Next $tabla_End = $iNumTables - $Numtables_datos ;############################################ FIN $tabla_Start = 4 $tabla_trafico = 2 For $for = 1 To $Numtables_datos Step 1 $oTable = _IETableGetCollection($oIE, $tabla_Start - 1) ; <<<<<<<<<<< NAME OF THE TABLE; row2 = mira $nomb_tabla = _IETableWriteToArray($oTable) ; <<<<<<<< TABLE TO ARRAY ;########################################### ADDS the traffic number into the row $string = StringStripWS($nomb_tabla[1][0], 8) If $string == "MIRA" Then ;si o si pasa por aca 1 vez _ArrayAdd($Datos_array, $nomb_tabla[0][0]) $nomb_aux = $nomb_tabla[0][0] $aux_x = 1 $tabla_trafico = $tabla_trafico + 2 Else ;esto deberia ser por row _ArrayAdd($Datos_array, $nomb_aux & " " & $aux_x) $aux_x = $aux_x + 1 $tabla_trafico = $tabla_trafico + 1 EndIf $oTable = _IETableGetCollection($oIE, $tabla_trafico) Local $aTableData = _IETableWriteToArray($oTable) $bps = _ArrayToString($aTableData, "|", 0, 0, @CRLF, 0, 0) $bps = StringRight($bps, 5) $bps = StringLeft($bps, 4) $trafico_actual = _ArrayToString($aTableData, "|", 0, 0, @CRLF, 2, 2) If $bps == "Gbps" Then $trafico_actual = $trafico_actual * 1000 If $bps == "Kbps" Then $trafico_actual = $trafico_actual / 1000 $Datos_array[$ar][1] = $trafico_actual $ar = $ar + 1 If $string == "MIRA" Then $tabla_Start = $tabla_Start + 2 Else $tabla_Start = $tabla_Start + 1 EndIf Next $ar = $ar + 1 ;~ ############# CAÍDA ############ ;~ If $actual_entrante = 0 Then ;~ $xxx = 0 ;~ Do ;~ MsgBox(0, "Tráfico Caído", $paginas[$i], 5) ;~ $xxx = $xxx + 1 ;~ Until $xxx = 10 ;~ EndIf ;~ ############# CAÍDA ############. Local $Numtables_datos = 0 Next _ArrayDisplay($Datos_array, "Array display") _IEQuit($oIE) Thanks!! monitoria.html
  3. Make that elegant (only one function call): ; verbose Local $res = _VersionCompare($Test_LocalFile_Ver, $Test_SourceFile_Ver) Switch $res Case -1 MsgBox(0, "", "Older") Case 0 MsgBox(0, "", "Same") Else MsgBox(0, "", "Newer") EndSwitch ; compact alternative Local $res = _VersionCompare($Test_LocalFile_Ver, $Test_SourceFile_Ver) MsgBox(0, "", $res < 0 ? "Older" : ($res = 0 ? "Same" : "Newer"))
  4. Today
  5. qwert, After significant effort, I have a case where expanding a folder which has another folder within it shows the name of the child folder as blank. (You had this problem.) This happens every time, not just once in a while. The drive is a USB memory stick. The first level of folders show AOK but expanding any of the folders that has a child fails to show the folder name. This is when _cFileSelectFolder is called from a relatively long production script (hundreds of lines of code); however _cFileSelectFolder behaves properly when it is called with the same parameters from a short test script. The old version of the production script calls FileSelectFolder. That expands folders AOK. I have created a version of the production script that allows the user to choose a child folder by calling Mebla23's _CFF_Choose. That version shows the child folder without a name when its parent is expanded (like my _cFileSelectFolder). You have suggested that there may be a bug in AutoIt. Based on the above, I am inclined to agree. An attempt to summarize my findings: sub folder's name shows: short test script, and production script that calls FileSelectFolder sub folder's name does not show: production script that calls _cFileSlectFolder, and production script that calls _CFF_Choose I am well aware that the way of telling the developers about a possible bug is to provide a short script that demonstrates the problem; however, in this case my short script always works AOK, so I do not know how to proceed. Suggestions are most welcome!
  6. @Jos, I am already running as #RequireAdmin. @AdamUL, it give the same False result. I have loads of other validations which are all correct. It is just this file which shows opposite result. 🤨 But when I change it as: If _VersionCompare($Test_LocalFile_Ver, $Test_SourceFile_Ver) = 0 Or _VersionCompare($Test_LocalFile_Ver, $Test_SourceFile_Ver) = 1 Then     MsgBox(0, "", "True") Else     MsgBox(0, "", "False") EndIf So _VersionCompare works in this case. But as per help file it as 3 validations which is why we can't put only = 0 and Else. 0 - Both versions equal 1 - Version 1 greater -1 - Version 2 greater End of the line, this works as per my need. Thank you.
  7. If the error is indeed due to the MAX_LINE limit, you should be able to address it by splitting the string and use either concatenation or using the long statement convention
  8. Post some code that demostrates your issue. Otherwise, we can only speculate on the source of the issue.
  9. I fixed that issue, but now I'm getting the unterminated string error because the array exceeds the max length for a line (it was like 9000 characters) how should I approach this issue
  10. Likely a bug in your code, but no way to tell since you haven't shown us any. 🙄
  11. I have a program with an array that includes 800 items. When I try to run it, it gives me this error (that, or "unterminated string"). What could be the issue? The error goes away when I decrease the size of the array. How can I have my array contain 800 items without getting an error?
  12. Yesterday
  13. Example below seems to work (just copy-paste from here) All credits for argumentum and Melba23, both referenced in the code: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <DateTimeConstants.au3> #include <WinAPI.au3> $hGUI = GUICreate("Test", 200, 200, 800, 200) $cDate1 = GUICtrlCreateDate("1953/04/25", 10, 10, 185, 20) $cDate2 = GUICtrlCreateDate("1953/04/25", 10, 50, 185, 20) $cButton = GUICtrlCreateButton("Submit", 10, 100, 50, 50, -1, -1) ;argumentum, Nov 2017 ;https://www.autoitscript.com/forum/topic/191058-datetime-pick-coloring/ Global $g_hDTP1 = GUICtrlGetHandle($cDate1) Global $g_hDTP2 = GUICtrlGetHandle($cDate2) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) ;Melba23, March 2014 ;https://www.autoitscript.com/forum/topic/159764-reading-gui-date-control-instantly/?do=findComment&comment=1161074 ; Start by looking for the Date control Switch _WinAPI_LoWord($wParam) ; ControlID of the control Case $cDate1, $cDate2 Local $tStruct = DllStructCreate($tagNMHDR, $lParam) If DllStructGetData($tStruct, "Code") = $DTN_DATETIMECHANGE Then ConsoleWrite("1: " & GUICtrlRead($cDate1) & " - 2: " & GUICtrlRead($cDate2) & @CRLF) EndIf EndSwitch ;Melba23, March 2014 ;https://www.autoitscript.com/forum/topic/159764-reading-gui-date-control-instantly/?do=findComment&comment=1161074 ; And then see if the ListView needs attention ;~ Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView ;~ ; Local $tBuffer ;~ $hWndListView = $Timelog_form_Listview ;~ If Not IsHWnd($hWndListView) Then $hWndListView = GUICtrlGetHandle($Timelog_form_Listview) ; etc, etc ;argumentum, Nov 2017 ;https://www.autoitscript.com/forum/topic/191058-datetime-pick-coloring/ Local $hWndFrom, $iCode, $tNMHDR, $iIDFrom $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "HwndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") Switch $hWndFrom Case $g_hDTP1, $g_hDTP2 Switch $iCode Case $NM_SETFOCUS ConsoleWrite("$NM_SETFOCUS" & @CRLF & "-->hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode & @CRLF) Case $NM_KILLFOCUS ConsoleWrite("$NM_KILLFOCUS" & @CRLF & "-->hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode & @CRLF) Consolewrite("+-> GUICtrlRead:" & @TAB & GUICtrlRead($cDate1) & @CRLF) EndSwitch EndSwitch EndFunc
  14. Thank you! Much better! $iMode [optional] Integer representing reading mode. Default is 0 (charset is decoded as it is ANSI). I should have played around with that.
  15. first question is why? Is a function variable not enough to help you with the why? $c=b $c() $c=a $c() func a() ConsoleWrite("Hello a" & @CRLF) EndFunc func b() ConsoleWrite("Hello b" & @CRLF) EndFunc Functions like assign can create true variables on the fly and with eval you can get the content of them
  16. Thanks for the help but this looks to be more of a learning curve and more time needed to be invested then I am willing to. My program needs to be simple to use and work on any computer/configuration. I want to avoid installing extra pieces like W3C WebDriver for Edge. I looked at UIAWrappers.au3 and can get it to click but it moves the mouse which I cannot do. Also, it clicks the wrong refresh and I am not sure how to identify which one to click. Each user’s dashboard can be setup different and there are multiple grids each with a refresh. I have a user-friendly program that can be configured with two clicks to pull the coordinates and browser information needed to automate refreshing the correct grid every 30 seconds with ControlClick and only send ControlClick when on the Dashboard. I will stick with what I have for now and not support Edge.
  17. check your previous thread I gave a full calculator example to learn from
  18. Ok full example on how to come where you want to be Start calc.exe Start Simplespy Hover on button 1 and press ctrl+w Example for a dutch W10 system ;~ *** Standard code maintainable *** #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) _UIA_setVar("oP1","Title:=Rekenmachine;controltype:=UIA_WindowControlTypeId;class:=ApplicationFrameWindow") ;Rekenmachine _UIA_setVar("oP2","Title:=Rekenmachine;controltype:=UIA_WindowControlTypeId;class:=Windows.UI.Core.CoreWindow") ;Rekenmachine _UIA_setVar("oP3","Title:=;controltype:=UIA_GroupControlTypeId;class:=LandmarkTarget") ; _UIA_setVar("oP4","Title:=Numeriek toetsenbord;controltype:=UIA_GroupControlTypeId;class:=NamedContainerAutomationPeer") ;Numeriek toetsenbord ;~ $oUIElement=_UIA_getObjectByFindAll("Een.mainwindow", "title:=Een;ControlType:=UIA_ButtonControlTypeId", $treescope_subtree) _UIA_setVar("oUIElement","Title:=Een;controltype:=UIA_ButtonControlTypeId;class:=Button") ;ControlType:=UIA_ButtonControlTypeId;classname:=Button") ;~ Actions split away from logical/technical definition above can come from configfiles ;~_UIA_Action("oP1","highlight") _UIA_Action("oP1","setfocus") ;~_UIA_Action("oP2","highlight") _UIA_Action("oP2","setfocus") ;~_UIA_Action("oP3","highlight") _UIA_Action("oP3","setfocus") ;~_UIA_Action("oP4","highlight") _UIA_Action("oP4","setfocus") _UIA_action("oUIElement","highlight") ;~_UIA_action("oUIElement","click") Clean up to something like this I leave out the hierarchy of the different parents as mainly mainwindow is needed and leaf in ui hierarchy. If you observe speedissues it can help to put in additional layers of the hierarchy ;~ *** Standard code maintainable *** #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) _UIA_setVar("oP1","Title:=Rekenmachine;controltype:=UIA_WindowControlTypeId;class:=ApplicationFrameWindow") ;Rekenmachine _UIA_setVar("oUIElement","Title:=Een;controltype:=UIA_ButtonControlTypeId;class:=Button") ;ControlType:=UIA_ButtonControlTypeId;classname:=Button") ;~ Actions split away from logical/technical definition above can come from configfiles _UIA_Action("oP1","highlight") _UIA_Action("oP1","setfocus") _UIA_action("oUIElement","highlight") _UIA_action("oUIElement","click") And play with instance property #_UIA_setVar("oUIElement","Title:=Een;controltype:=UIA_ButtonControlTypeId;class:=Button") ;ControlType:=UIA_ButtonControlTypeId;classname:=Button") _UIA_setVar("oUIElement","controltype:=UIA_ButtonControlTypeId;instance:=1") ;ControlType:=UIA_ButtonControlTypeId;classname:=Button") And transformed to a full example (hopefully works in different languages of W10 directly) AutoItSetOption("MustDeclareVars", 1) #include "UIAWrappers.au3" Example() Func Example() Local $sp=wingetprocess("[active]") ; Run calc with the window maximized. Local $iPID = Run("calc", "", @SW_SHOWMAXIMIZED) ; Wait for the calc window to appear and be active Local $maxTry=1 while ($sp=wingetprocess("[active]")) and $maxTry <= 10 sleep(1000) $maxTry=$maxTry+1 WEnd ; Wait for 2 seconds. Sleep(2000) Local $calcTitle=wingettitle("[active]") ;~ Declaration of reference definitions could be put in UIA.CFG ;~ [calc] ;~ oP1=Title:=Rekenmachine;controltype:=UIA_WindowControlTypeId;class:=ApplicationFrameWindow ;~ oUIElement=controltype:=UIA_ButtonControlTypeId;instance:=11 ;~ But will do it for demo in coding _UIA_setVar("oP1","Title:=" & $calcTitle & ";controltype:=UIA_WindowControlTypeId;class:=ApplicationFrameWindow") ;Rekenmachine _UIA_setVar("oUIElement","controltype:=UIA_ButtonControlTypeId;instance:=11") ;ControlType:=UIA_ButtonControlTypeId;classname:=Button") ;~ Actions split away from logical/technical definition above can come from configfiles _UIA_Action("oP1","highlight") _UIA_Action("oP1","setfocus") _UIA_action("oUIElement","highlight") _UIA_action("oUIElement","click") ;~ Just a bunch of buttons to highlight using instance property with dynamic description for $i=10 to 34 _UIA_action("controltype:=UIA_ButtonControlTypeId;instance:=" & $i ,"highlight") Next sleep(5000) ; Close the calc process using the PID returned by Run. ProcessClose($iPID) EndFunc ;==>Example
  19. Oh, that is a given but, I am simply the script Guy, he is the money guy with the idea.. So..... I currently have to defer to him.
  20. Try _WinHttpReadData($hRequest, 1) .
  21. Updated to v2.0 (see first post for download and new screenshot). (v2.0) Upon further investigation, it seems my issue with Project Gutenberg, is not the case for everyone, so I have now made HTTP instead of HTTPS optional. The checkbox for this option, is a three state one, where you can elect to have all HTTPS changed to HTTP, or just for Project Gutenberg or no change. The third party program 'wget.exe' if placed in the program folder, can now be used instead for downloading, if enabled.
  22. you were given the way. read this FAQ as mentioned here before https://www.autoitscript.com/wiki/FAQ#Does_AutoIt_support_database_connections.2C_such_as_SQL.3F
  23. ControlClick("Start", "", "ApplicationFrameInputSinkWindow1", "left", 1, 740, 186) This does return a 1 so I guess it is clicking but Edge is not responding to it. I will look for another way to trigger the element.
  24. Use the _VersionCompare function for comparing file versions. #include <Misc.au3> Local $Test_LocalFile = "C:\Program Files\Test\App1.exe" Local $Test_LocalFile_Ver = FileGetVersion($Test_LocalFile, "ProductVersion") Local $Test_SourceFile_Ver = IniRead("c:\Test.ini", "Apps", "App1", "") If _VersionCompare($Test_LocalFile_Ver, $Test_SourceFile_Ver) = 0 Then MsgBox(0, "", "True") Else MsgBox(0, "", "False") EndIf Adam
  25. Oh the shame!... I have such a big ini that i forgot to uncomment that particular key... Please forgive me. You can remove the post, if you like. Thank you for your help and again... sorry.
  1. Load more activity
×
×
  • Create New...