Miguel Posted December 7, 2008 Posted December 7, 2008 Hi, I´m writting from Portugal, so sorry for my bad english I have searched in the forum, and i couldn´t find the answer to my problem. I´m trying to get some information from the html code of a web page. I Want to obtain the tag id (in this case = f3). The page has other div tags, this is only one small piece of the html code. The tag id could vary from f1 to f6. <div id="f3"> after some hours, i have reached to this: this works fine, the id is displayed in the array $oDivs = _IETagNameGetCollection($IE_Browser, "DIV") For $oDiv In $oDivs $aRegEx = StringRegExp($oDiv.id, 'f[1-6]', 3) _ArrayDisplay($aRegEx) Next I need to use the variable in a following part of the code, But when i run this i get a ERROR: $oDivs = _IETagNameGetCollection($IE_Browser, "DIV") For $oDiv In $oDivs $aRegEx = StringRegExp($oDiv.id, 'f[1-6]', 3) MsgBox(0, "Result", $aRegEx[0]) Next This is the ERROR: Subscript used with non-Array variable.: MsgBox(0, "Result", $aRegEx[0]) MsgBox(0, "Result", $aRegEx^ ERROR I´m confused Coud someone help me
Josbe Posted December 7, 2008 Posted December 7, 2008 $oDivs = _IETagNameGetCollection($IE_Browser, "DIV") For $oDiv In $oDivs $aRegEx = StringRegExp($oDiv.id, 'f[1-6]', 3) If NOT @error Then MsgBox(0, "Result", $aRegEx[0]) EndIf Next Read about "Return Error" in StringRegExp() reference. The error is displayed because StringRegExp() doesn't return an array when doesn't match with the pattern. AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta
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