Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/06/2020 in all areas

  1. Here it is running as well. If you run the following script you get the full error information written to the console: $oError = ObjEvent("AutoIt.Error", "_COMError") $oUser = ObjGet("WinNT://" & @LogonDomain & "/" & @UserName) If @error Then Exit MsgBox(0, 'Username', 'Error ' & @error & ' connecting to domain!') MsgBox(0, 'Username', $oUser.FullName) $oUser = 0 $oError = ObjEvent("AutoIt.Error", "") Exit Func _COMError($oError) ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc
    1 point
  2. 1 point
  3. @Danyfirex and I, we are working On ATCmd.au3 UDF. WILL BE FINISHED THIS MONTH.
    1 point
  4. OK, next tryπŸ™„ #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_Fileversion=0.0.0.51 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GuiComboBoxEx.au3> #include <GUIConstantsEx.au3> #include <GuiImageList.au3> #include <GDIPlus.au3> #include <ButtonConstants.au3> #include <WindowsConstants.au3> Global $Country Global $iCombo Global $hCombo Example() Func Example() Local $hGUI, $hImage ; Create GUI $hGUI = GUICreate("ComboBoxEx Set Image List", 1000, 800) $hCombo = _GUICtrlComboBoxEx_Create($hGUI, "", 2, 2, 700, 500) $btnCountrySite = GUICtrlCreateButton("κ΅­κ°€ 검색", 710, 2, 100, 55) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") _GDIPlus_Startup() InetGet("https://upload.wikimedia.org/wikipedia/commons/thumb/e/e8/World_blank_map_countries.PNG/320px-World_blank_map_countries.PNG", "World.png") $hImage = _GUIImageList_Create(100, 50, 5, 3, 1) ;~ SetComboImage($hImage, @ScriptDir & "\Country\01_λ…Έλ₯΄μ›¨μ΄.png") ;~ SetComboImage($hImage, @ScriptDir & "\Country\02_덴마크.png") ;~ SetComboImage($hImage, @ScriptDir & "\Country\03_ν•€λž€λ“œ.png") SetComboImage($hImage, @ScriptDir & "\World.png") SetComboImage($hImage, @ScriptDir & "\World.png") SetComboImage($hImage, @ScriptDir & "\World.png") ;Set Image List Local $hPrevlist = _GUICtrlComboBoxEx_SetImageList($hCombo, $hImage) _GUICtrlComboBoxEx_AddString($hCombo, StringFormat("%03d : λ…Έλ₯΄μ›¨μ΄", 1), 0, 0) _GUICtrlComboBoxEx_AddString($hCombo, StringFormat("%03d : 덴마크", 2), 1, 1) _GUICtrlComboBoxEx_AddString($hCombo, StringFormat("%03d : ν•€λž€λ“œ", 3), 2, 2) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $btnCountrySite ;κ΅­κ°€ 검색 λ²„νŠΌμ„ λˆŒλ €μ„ 경우 $iCombo = _GUICtrlComboBoxEx_GetCurSel($hCombo) _GUICtrlComboBoxEx_GetItemText($hCombo, $iCombo, $Country) ShellExecute("https://www.google.at/search?q=" & StringTrimLeft($Country, 6)) EndSwitch WEnd EndFunc ;==>Example Func SetComboImage($hImage, $iFilename) Local $hPng = _GDIPlus_ImageLoadFromFile($iFilename) Local $hBmp = _GDIPlus_ImageResize($hPng, 100, 50) $hBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp) _WinAPI_DeleteObject($hPng) ;release GDI bitmap resource because not needed anymore ConsoleWrite(_GUIImageList_Add($hImage, $hBmp) & @CRLF) EndFunc ;==>SetComboImage Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $nNotifyCode = _WinAPI_HiWord($wParam) Local $iId = _WinAPI_LoWord($wParam) Local $hCtrl = $lParam If $hCtrl = $hCombo And $nNotifyCode = $CBN_SELCHANGE Then ; $iCombo = _GUICtrlComboBoxEx_GetCurSel($hCombo) _GUICtrlComboBoxEx_GetItemText($hCombo, $iCombo, $Country) ShellExecute("https://www.google.at/search?q=" & StringTrimLeft($Country, 6)) Return 0 EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Could you please at least try to find out how things work? Google and the AutoIt documentation will always help you.
    1 point
  5. @Dana86 Recently, someone was complaining the same thing as you. His program was taking multiple hours to complete in AutoIt. With his requirements, I created the same functionality and was able to run the same data in 4.5 secs. AutoIt is not about speed or slowness , it is how strong is your algorithm. A bad programmatic algorithm will take forever no matter is the language you are using. If you doubt that, then show your code !
    1 point
  6. Using the _WD_ElementActionEx function, I can "right click" on an element to show the context menu. But how can I interact with the context menu, e.g selecting an item. I tried to send keystrokes but did not success: $elementInput = _WD_FindElement($sessionID, $_WD_LOCATOR_ByXPath, "(//input[contains(@name,'q')])[1]") _WD_ElementActionEx($sessionID, $elementInput, "rightclick") $sAction = '{"actions":[{"type": "key", "id": "default keyboard", "actions": [{"type": "keyDown", "value": "\uE015"}, {"type": "keyUp", "value": "\uE015"}, {"type": "keyDown", "value": "\uE015"}, {"type": "keyUp", "value": "\uE015"}, {"type": "keyDown", "value": "\uE015"}, {"type": "keyUp", "value": "\uE015"}, {"type": "keyDown", "value": "\uE015"}, {"type": "keyUp", "value": "\uE015"}]}]}' ; $sAction = '{"actions":[{"type": "key", "id": "default keyboard", "actions": [{"type": "keyUp", "value": "Q"}, {"type": "keyDown", "value": "Q"}]}]}' ; Send the key Q which is shortcut for the Inspect Element menu _WD_Action($sessionID, "actions", $sAction) Can anyone help me please?
    1 point
  7. Hello Dan2, I used this function and I get an error. I am trying to get the content from a table... This is my error... Unable to locate an element with the xpath expression 14d18d66-2e47-4995-b669-3bc9ed9d1dbc/tbody/tr because of the following error:\nSyntaxError: Failed to execute 'evaluate' on 'Document': The string '14d18d66-2e47-4995-b669-3bc9ed9d1dbc/tbody/tr' is not a valid XPath expression. This is what I use to call the function... $sTableV = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//table[@class='"&$sTable_Class&"']") _ArrayDisplay(_WD_GetTableContent($sSession, $sTableV, "##")) FindElement returns the element, but when I pass that element to GetTableContent I get the error above... so you can see the guid appended to the /tbody/tr... what am I doing wrong...???
    1 point
  8. Time ago I wrote a function to extract data from the source HTML code of tables. https://www.autoitscript.com/forum/topic/167679-read-data-from-html-tables-from-raw-html-source/ Seems that that function fits very well to be used with the webBrowser udf. Just save the _HtmlTable2Array.au3 and #include it in your listing. here a simple example of use (I'm using IE here, but of course you can change settings to let the WebDriver use your preferred browser) ; Open a web page with a table, get a reference to the first table ; on the page (index 0) and read its contents into a 2-D array #include <Array.au3> #include 'wd_helper.au3' #include '_HtmlTable2Array.au3' ; <- get it from blow link ; https://www.autoitscript.com/forum/topic/167679-read-data-from-html-tables-from-raw-html-source/ ; === setup WebDriver for IE =============== $_WD_DEBUG = False Global $sDesiredCapabilities Global $sSession _SetupIE() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) ; ========================================== _Example_TableWriteToArray() Func _Example_TableWriteToArray() ; -- open a web page containing a table (ok also if there are more tables) _WD_Navigate($sSession, "https://www.beginnersguidetohtml.com/guides/html/tables/complex-tables") ; get a 'list' of the tables in the page $aTables = _WD_FindElement($sSession, $_WD_LOCATOR_ByTagName, "table", '', True) ; get the HTML source of the first table (index 0) change index if you need another table $sTable_HTML_source = _WD_ElementAction($sSession, $aTables[0], 'property', 'outerHTML') Local $aMyTable ; ------------------------------------------------------------------------------------ ; the _HtmlTableWriteToArray() function extract the data content from the HTML source ; and save data in a 2d Array. (if second parameter is true it fill cells of the array ; corresponding to the span areas with spanned data (data is spread over the cells) ; ------------------------------------------------------------------------------------ $aMyTable = _HtmlTableWriteToArray($sTable_HTML_source) _ArrayDisplay($aMyTable, "Data without spread") $aMyTable = _HtmlTableWriteToArray($sTable_HTML_source, True) _ArrayDisplay($aMyTable, "Data spreaded") ; ------------------------------------------------------------------------------------ EndFunc ;==>_Example_TableWriteToArray Func _SetupIE() _WD_Option('Driver', 'IEDriverServer.exe') _WD_Option('Port', 5555) _WD_Option('DriverParams', '--log-file=' & @ScriptDir & '\IE.log') $sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}' EndFunc ;==>_SetupIE
    1 point
×
×
  • Create New...