Gaviel Posted October 28, 2010 Author Share Posted October 28, 2010 (edited) which variable obtain the output ?! I tried MsgBox(64, "Result", "VanBlattidCat = " & $bolRET) But it didn't display output .. Sorry I'm new to this .. Edited October 28, 2010 by Gaviel Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 28, 2010 Share Posted October 28, 2010 That $bolRET is LOCAL inside the function, so you don't see it outside the function. In my demo, the return value of the function is still stored in and displayed from $RET. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Gaviel Posted October 28, 2010 Author Share Posted October 28, 2010 (edited) so you mean it should look like this ?! $RET = _TestDiv("VanBlattidCat") MsgBox(64, "Result", "VanBlattidCat = " & $RET) Func _TestDiv($sSearch) Local $bolRET = False, $iErr = 1 $colDiv = _IETagNameGetCollection($oIE, "DIV") For $oDiv In $colDiv If StringInStr(_IEPropertyGet($oDiv, "innerText"), $sSearch) Then $iErr = 0 $oSib = $oDiv.nextSibling If IsObj($oSib) And $oSib.className & "" = "ldetails" Then $bolRET = True ExitLoop EndIf EndIf Next Return SetError($iErr, 0, $bolRET) EndFunc ;==>_TestDiv EDIT : Tried that but instead of an ERROR .. The script return a FALSE .. The script should return ERROR cause 'VanBlattidCat' doesn't exist in the HTML code .. what could be the problem !? Edited October 28, 2010 by Gaviel Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 28, 2010 Share Posted October 28, 2010 (edited) When the initial search string is not found the @error macro is set, not an "ERROR" string. You would test it this way: $sSearch = "VanBlattidCat" $RET = _TestDiv($sSearch) MsgBox(64, "Result", "Searched for: " & $sSearch & @CRLF & _ "$RET = " & $RET & @CRLF & _ "@error = " & @error) Func _TestDiv($sSearch) Local $bolRET = False, $iErr = 1 $colDiv = _IETagNameGetCollection($oIE, "DIV") For $oDiv In $colDiv If StringInStr(_IEPropertyGet($oDiv, "innerText"), $sSearch) Then $iErr = 0 $oSib = $oDiv.nextSibling If IsObj($oSib) And $oSib.className & "" = "ldetails" Then $bolRET = True ExitLoop EndIf EndIf Next Return SetError($iErr, 0, $bolRET) EndFunc ;==>_TestDiv You might also use the "If Not @error" example previously given. The contents of $RET (True/False) tell you if the total conditions were met, while the status of @error (0/1) tells you if failed to find the search string at all. You really need to get a grip on this, as most AutoIt functions use the @error macro to report various conditions, so you WILL see this again. Edited October 28, 2010 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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