tomq 1 Posted November 3, 2011 Report Share Posted November 3, 2011 change-urls contains this text:http://www.ticketfly.com/purchase/event/59869/tflybasically i'm trying to make a loop that waits for this page to change using "off sale" as the string keywordhttp://www.ticketfly.com/purchase/event/59869/tflyhowever i get a object reference not set to object error, and i think i'm doing the loop completely right setting the list position to 0 when the list position EQUALS the list total i.e. index would then be out of bounds so i reset the list position to 0.....not sure how to fix it, what does it look like i'm doing wrong? thanks in advance =)! add list to list(%changeurls, $list from file("C:\\change-urls.txt"), "Delete", "Global")navigate($list item(%changeurls, 0), "Wait")wait for browser event("Everything Loaded", "")loop while($search page("Off Sale")) { if($comparison($list position(%changeurls), "=", $list total(%changeurls))) { then { set list position(%changeurls, 0) } else { } } wait(10) navigate($next list item(%changeurls), "Wait") wait for browser event("Everything Loaded", "")} 1 Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted November 3, 2011 Report Share Posted November 3, 2011 try this clear list(%changeurls) add list to list(%changeurls, $list from file("C:\\change-urls.txt"), "Delete", "Global") navigate($list item(%changeurls, 0), "Wait") wait for browser event("Everything Loaded", "") wait(10) set(#temp, 1, "Global") loop while($search page("Off Sale")) { if($comparison(#temp, "=", $list total(%changeurls))) { then { set list position(%changeurls, 0) set(#temp, 0, "Global") } else { navigate($list item(%changeurls, #temp), "Wait") wait for browser event("Everything Loaded", "") wait(10) } } increment(#temp) } Not sure exactly what your trying to accomplish here. But assume this is what your looking for. If not let me know more and will adjust it. TJ 1 Quote Link to post Share on other sites
Praney Behl 314 Posted November 4, 2011 Report Share Posted November 4, 2011 Another way to do this could be using the screenshot feature if you are having issues using $search page. Quote Link to post Share on other sites
tomq 1 Posted November 4, 2011 Author Report Share Posted November 4, 2011 ok here's the working code, i ditched doing it with the if-then statement and decided to just do ubot's version of a for loop with the max number of urls -1, i.e. the index is always 1 less then the total...basically all this script would do is given a list of urls it would search a web page for two specified strings, in my case off sale and sold out and the loop would continue until those words were not found on the set of pages in the list %changeurls clear list(%changeurls)add list to list(%changeurls, $list from file("C:\\change-urls.txt"), "Delete", "Global")navigate($list item(%changeurls, 0), "Wait")wait for browser event("Everything Loaded", "")wait(10)set(#maxurls, $list total(%changeurls), "Global")loop while($either($search page("Off Sale"), $search page("Sold Out"))) { set list position(%changeurls, 0) loop($subtract(#maxurls,1)) { navigate($next list item(%changeurls), "Wait") }} Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.