oemript Posted July 6, 2019 Share Posted July 6, 2019 Referring to following image, I would like to know on how to retrieve the class name under id="star_span" into variable Does anyone have any suggestions? Thanks in advance for any suggestions Link to comment Share on other sites More sharing options...
Developers Jos Posted July 6, 2019 Developers Share Posted July 6, 2019 How is this different from the post in your previous thread ? What have you tried? In other words: You really should know better by now than post questions without any effort to show for..... right? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
oemript Posted July 7, 2019 Author Share Posted July 7, 2019 (edited) Referring to following coding, I would like to search for id="star_span" and return classname = "r_star0" Do you have any suggestions? Thank you very much for any suggestions (^v^) #include <IE.au3> While ProcessExists("iexplore.exe") ProcessClose("iexplore.exe") WEnd ; 6886 Global $oIE = _IECreate("https://financials.morningstar.com/ratios/r.html?t=0P0001648D&culture=en&platform=sal") Local $hIE = WinGetHandle("[Class:IEFrame]") Local $sSearch = "NIL" Local $oDivs = _IETagNameGetCollection($oIE, "star_span") WinActivate($hIE) For $oDiv In $oDivs If StringInStr($oDiv.ClassName, "r_star0") Then $sSearch &= 0 If StringInStr($oDiv.ClassName, "r_star1") Then $sSearch &= 1 If StringInStr($oDiv.ClassName, "r_star2") Then $sSearch &= 2 If StringInStr($oDiv.ClassName, "r_star3") Then $sSearch &= 3 If StringInStr($oDiv.ClassName, "r_star4") Then $sSearch &= 4 If StringInStr($oDiv.ClassName, "r_star5") Then $sSearch &= 5 Next MsgBox(32, "Search Items", $sSearch ) Edited July 7, 2019 by oemript Link to comment Share on other sites More sharing options...
Developers Jos Posted July 7, 2019 Developers Share Posted July 7, 2019 (edited) Why are you searching for a colllection when you only want to get the Classname of a specific ID? Isn't this what you want: Global $oIE = _IECreate("https://financials.morningstar.com/ratios/r.html?t=0P0001648D&culture=en&platform=sal") Local $oID = _IEGetObjById($oIE, "star_span") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $oID.ClassName = ' & $oID.ClassName & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console Jos Edited July 7, 2019 by Jos oemript 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
oemript Posted July 7, 2019 Author Share Posted July 7, 2019 Thank you very much for suggestions (^v^) Link to comment Share on other sites More sharing options...
oemript Posted July 7, 2019 Author Share Posted July 7, 2019 (edited) Referring to following image, I have already added 5 seconds to wait and still get error (showing error for sixth / seventh items within loop) would like to know on what wrong it is and how to handle it property. Web page is loaded successfully, Do you have any suggestions? Thank you very much for any suggestions (^v^) Global $oIE = _IECreate("https://financials.morningstar.com/ratios/r.html?t=0P00009ROZ&culture=en&platform=sal") _IELoadWait($oIE, 5000) Local $sSearch = "" Local $oID = _IEGetObjById($oIE, "star_span") Edited July 7, 2019 by oemript Link to comment Share on other sites More sharing options...
Developers Jos Posted July 7, 2019 Developers Share Posted July 7, 2019 (edited) 39 minutes ago, oemript said: Do you have any suggestions? Yes: Type the correct url and do some proper error checking. Edited July 7, 2019 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
oemript Posted July 7, 2019 Author Share Posted July 7, 2019 (edited) I would like to know on why _IEQuit($oIE) cannot be executed in case of error and still display error as shown below: "C:\Program Files (x86)\AutoIt3\Include\IE.au3" (1900) : ==> The requested action with this object has failed.: If IsObj($oObject.document.getElementById($sID)) Then If IsObj($oObject.document^ ERROR After adding Global COM Error, I would like to know on what 1900 is about. Do you have any suggestions? Thank you very much for any suggestions (^v^) expandcollapse popup#include <IE.au3> Global $oGlobalCOMErrorHandler = ObjEvent("AutoIt.Error", "_ErrFuncGlobal") ; Global COM error handler While ProcessExists("iexplore.exe") ProcessClose("iexplore.exe") WEnd ; 6886 Global $oIE = _IECreate("https://financials.morningstar.com/ratios/r.html?t=0P0001648D&culture=en&platform=sal") Local $hIE = WinGetHandle("[Class:IEFrame]") Local $sSearch = "NIL" Local $oID = _IEGetObjById($oIE, "star_span") if @error then ContinueLoop _IEQuit($oIE) else WinActivate($hIE) If StringInStr($oID.ClassName, "r_star0") Then $sSearch &= 0 If StringInStr($oID.ClassName, "r_star1") Then $sSearch &= 1 If StringInStr($oID.ClassName, "r_star2") Then $sSearch &= 2 If StringInStr($oID.ClassName, "r_star3") Then $sSearch &= 3 If StringInStr($oID.ClassName, "r_star4") Then $sSearch &= 4 If StringInStr($oID.ClassName, "r_star5") Then $sSearch &= 5 MsgBox(32, "Search Items", $sSearch ) endif ; Global COM error handler Func _ErrFuncGlobal($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> Global COM error handler - 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 Edited July 7, 2019 by oemript Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted July 8, 2019 Share Posted July 8, 2019 @oemript 1. Why there is a ContinueLoop where there's no loop? 2. If you read carefully on the left of 1900, you'll see "err.scriptline: ", so, 1900 is the line where the error occurred; 3. You should look for the Error Code which is 80020008, which means "Bad variable type"; 4. Why do you use Win* functions to get the handle of IE instead of using _IEPropertyGet($objIE, "hwnd"); 5. &= Is a concatenation operator with strings, and you are using with integers. Please, pay more attention on what you are doing, since, as @JLogan3o13 stated in one of your last threads, people are tired to see people only asking for code instead of putting a minimum effort to solve their "issues" Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Developers Jos Posted July 8, 2019 Developers Share Posted July 8, 2019 8 hours ago, oemript said: I would like to know on why _IEQuit($oIE) cannot be executed in case of error and still display error as shown below: I gave you the answer so READ and THINK and CHECK!: 13 hours ago, Jos said: Yes: Type the correct url and do some proper error checking. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
oemript Posted July 8, 2019 Author Share Posted July 8, 2019 After READ and THINK and CHECK then SOLVED. Thanks, to everyone very much for suggestions (^v^) Link to comment Share on other sites More sharing options...
oemript Posted July 8, 2019 Author Share Posted July 8, 2019 (edited) Referring to following image, Error occur before 3, but it never goes to 4 and stop. I would like to know on how to manage error handle in case of any error, so it would jump to error section to perform _IEQuit($oIE). Does anyone have any suggestions? Thanks in advance for any suggestions Local $sURL = "https://financials.morningstar.com/ratios/r.html?t=0P00009ROZ&culture=en&platform=sal" Do While ProcessExists("iexplore.exe") ProcessClose("iexplore.exe") WEnd ; 1 ConsoleWrite ( "1" ) Global $oIE = _IECreate($sURL) ConsoleWrite ( "2" ) _IELoadWait($oIE, 5000) ConsoleWrite ( "3" ) Local $oID = _IEGetObjById($oIE, "star_span") ConsoleWrite ( "4" ) If @error Then ConsoleWrite ( "5" ) ContinueLoop ConsoleWrite ( "6" ) MsgBox($MB_SYSTEMMODAL, "", "An error occurred whilst writing the temporary file.") ConsoleWrite ( "7" ) _IEQuit($oIE) ConsoleWrite ( "8" ) EndIf $i = $i + 1 Until $i > 50 Edited July 8, 2019 by oemript Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted July 8, 2019 Share Posted July 8, 2019 @oemript Why are you executing that code 50 times when there is only one object with that id? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Developers Jos Posted July 8, 2019 Developers Share Posted July 8, 2019 1 hour ago, oemript said: Does anyone have any suggestions? Yes... but you still haven't fixed the issue from the previous thread in that code, so why did you start a new thread? Consider this your final warning as the next time you ask the same question without showing ANY new effort, you will get a vacation from our forums! So: Start learning some basics and do the work YOURSELF ! Jos Earthshine and FrancescoDiMuro 1 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now