pallavi Posted November 20, 2008 Share Posted November 20, 2008 (edited) Hiii Alll.....I am trieng to find the link objects in the web page... I can get the objects using _IELinkGetCollection successfully..... While Looping that am getting problem .... i mentioned my sample script below :For Below script it will work fine & loop across all 10 links...For $oLink in $oLinks $sLinkText = _IEPropertyGet($oLink, "innerText") If StringInStr($sLinkText, $sMyString) Then $check_string = $oLink.href If StringInStr($check_string, $sMyString) Then Sleep(200) Else $IEAction($oLink, "focus") EndIf EndIf NextBUT ; If i open any link & comes back to original page & then continue the LOOP ; then it will exit from the For Loop ; sample script Given below :For $oLink in $oLinks $sLinkText = _IEPropertyGet($oLink, "innerText") If StringInStr($sLinkText, $sMyString) Then $check_string = $oLink.href If StringInStr($check_string, $sMyString) Then Sleep(200) Else $tmp_oLink = $oLink ; $tmp_oLinks = $oLinks ; $count_row = $count_row + 1; _IEAction($oLink, "focus") Sleep(1000) _IEAction($oLink, "click") sleep(5000);;~ ;_IELoadWait ($oIE) $o_Form = _IEFormGetObjByName ($oIE , "cat" ); $o_jname = _IEFormElementGetObjByName ($o_Form , "comp"); $c_name = _IEFormElementGetValue ($o_jname) ; WinActivate ("Microsoft Excel - Book1") sleep(500); $oExcel.ActiveWorkBook.ActiveSheet.Cells($count_row, 1 ).Value= $c_name $o_cdetails = _IEGetObjById ( $oIE, "cCardContact") $test = _IEPropertyGet ($o_cdetails, "innertext") $array = StringSplit($test, @LF) ; $lines = @extended For $i = 1 to $array[0] Step 1 $last_count = $array[0] -2; $data = $array[$i] ; if ( $i = 1 ) Then $test_string = StringRegExp ($data , '[^0-9]' ) ; EndIf $test_phone = StringRegExp ($data , '[0-9]' ) ; $test_email = StringInStr ( $data, "@" ) ; $test_web = StringInStr ( $data, "www." ) ; if ( $i = 1 and $test_string = 1 ) Then $oExcel.ActiveWorkBook.ActiveSheet.Cells($count_row, 2 ).Value= $data Else $oExcel.ActiveWorkBook.ActiveSheet.Cells($count_row, 3 ).Value= $data EndIf if ( $test_phone = 1 and $i <> $last_count ) Then $oExcel.ActiveWorkBook.ActiveSheet.Cells($count_row, 3 ).Value= $data;~ ;MsgBox(1, "i", $i); ;~ ;MsgBox(1, "last_count", $last_count); EndIf if ( $test_email = 1 ) Then $oExcel.ActiveWorkBook.ActiveSheet.Cells($count_row, 5 ).Value= $data EndIf if ( $test_web = 1 ) Then $oExcel.ActiveWorkBook.ActiveSheet.Cells($count_row, 6 ).Value= $data EndIf if ( $i = $last_count ) Then $oExcel.ActiveWorkBook.ActiveSheet.Cells($count_row, 7 ).Value= $data endif; Next sleep(500); WinActivate ("Just Dial - India's No.1 local search engine") sleep(1000); _IEAction($oIE, "back"); _IELoadWait ($oIE); WinActivate ("Just Dial - India's No.1 local search engine") $oLink = $tmp_oLink ; $oLinks = $tmp_oLinks ; EndIf EndIf NextCan Any one Help me to solve this Problem ???? Edited November 20, 2008 by pallavi Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 20, 2008 Share Posted November 20, 2008 Hiii Alll.....I am trieng to find the link objects in the web page... I can get the objects using _IELinkGetCollection successfully..... While Looping that am getting problem .... i mentioned my sample script below :For Below script it will work fine & loop across all 10 links...BUT ; If i open any link & comes back to original page & then continue the LOOP ; then it will exit from the For Loop ; Can Any one Help me to solve this Problem ????If you navigate the browser away from the page you got the links from, all the DOM objects from the old page lose their reference. You need to collect the URLs from all links and navigate to those or open them in other browser instances. 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...
pallavi Posted November 21, 2008 Author Share Posted November 21, 2008 hELLO THAT WORKS Great!!! Thanks a lot for your valueable reply................... Thanksss 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