botsimmer 16 Posted November 10, 2015 Report Share Posted November 10, 2015 Hi peeps, I am trying to get the progress bar to work with the duration of the program. But it does not seem to increment up. I would expect that the code and Navigate shoudl go into the loop but seems the loop not starting. Here is the code: ui html panel("<body><progress variable=\"#progress\" fillwith=\"value\" max=\"100\" style=\"width:300px;\"></progress><b><span variable=\"#progress\" fillwith=\"innerhtml\"></span>%</b></body>","")set(#progress,0,"Global")set(#loopcount,1,"Global")set(#loopcount,$list total(%searchtitles),"Global")clear list(%searchtitles)ui text box("keyword:",#keyword)loop($list total(%searchtitles)) { navigate("https://www.google.com/?gws_rd=ssl","Wait") wait for browser event("Everything Loaded","") wait(4) type text(<name="q">,"winter gloves","Standard") wait(4) click(<login button>,"Left Click","No") wait(4) add list to list(%searchtitles,$scrape attribute(<onmousedown=w"return rwt(this,\'\',\'\',\'\',\'*\',\'*\',\'\',\'*\',\'\',\'\',event)">,"innertext"),"Delete","Global") wait(4) click(<id="pnnext">,"Left Click","No") wait for browser event("Page Loaded","") wait(4) add list to list(%searchtitles,$scrape attribute(<onmousedown=w"return rwt(this,\'\',\'\',\'\',\'*\',\'*\',\'\',\'*\',\'\',\'\',event)">,"innertext"),"Delete","Global") wait(4) load html("Loop: {#loopcount} of {$list total(%searchtitles)}<br><b>{$next list item(%searchtitles)}</b>") set(#progress,$eval("var tmp1 = {$multiply($divide(#loopcount,$list total(%searchtitles)),100)}; tmp2 = Math.floor(tmp1);tmp2"),"Global") increment(#loopcount)}stop script Can anyone shed any light on this please? Thanks in advance. Quote Link to post Share on other sites
HelloInsomnia 1103 Posted November 10, 2015 Report Share Posted November 10, 2015 Are you trying to grab the titles from the results in Google? And are you trying to show the progress for the amount of pages it is scraping and if so what is the max number of pages (usually 10)? I'm just a bit confused on what your objectives are but if you can tell some more info I might be able to modify it for you. Quote Link to post Share on other sites
pash 504 Posted November 11, 2015 Report Share Posted November 11, 2015 for post code Quote Link to post Share on other sites
botsimmer 16 Posted November 11, 2015 Author Report Share Posted November 11, 2015 Hi there, yes its for titles but just 2 pages but would like the progress bar to end at 100 % when the 2nd add list to list has been completedAre you trying to grab the titles from the results in Google? And are you trying to show the progress for the amount of pages it is scraping and if so what is the max number of pages (usually 10)? I'm just a bit confused on what your objectives are but if you can tell some more info I might be able to modify it for you. Quote Link to post Share on other sites
botsimmer 16 Posted November 11, 2015 Author Report Share Posted November 11, 2015 Thanks for that - wondered how it was done with the different colors - for post code Quote Link to post Share on other sites
HelloInsomnia 1103 Posted November 11, 2015 Report Share Posted November 11, 2015 I made some changes to it, I'm not sure what exactly you want to show at the end with the load html so I left that be I guess maybe that it did 2 pages? ui html panel("<body> <p>Keyword: <input type=\"text\" variable=\"#keyword\"></p> <progress variable=\"#progress\" fillwith=\"value\" max=\"100\" style=\"width:300px;\"></progress> <b><span variable=\"#progress\" fillwith=\"innerhtml\"></span>%</b> </body>","") set(#progress,0,"Global") set(#loopcount,2,"Global") set(#page,0,"Global") navigate("https://www.google.com/","Wait") wait for browser event("Everything Loaded","") type text(<name="q">,#keyword,"Standard") wait(4) click(<login button>,"Left Click","No") wait(4) clear list(%searchtitles) loop(#loopcount) { add list to list(%searchtitles,$scrape attribute(<onmousedown=w"return rwt(this,\'\',\'\',\'\',\'*\',\'*\',\'\',\'*\',\'\',\'\',event)">,"innertext"),"Delete","Global") wait(4) click(<id="pnnext">,"Left Click","No") increment(#page) wait for browser event("Page Loaded","") wait(4) add list to list(%searchtitles,$scrape attribute(<onmousedown=w"return rwt(this,\'\',\'\',\'\',\'*\',\'*\',\'\',\'*\',\'\',\'\',event)">,"innertext"),"Delete","Global") wait(4) set(#progress,$eval("var tmp1 = {$multiply($divide(#page,#loopcount),100)}; tmp2 = Math.floor(tmp1); tmp2"),"Global") } load html("Loop: {#loopcount} of {$list total(%searchtitles)}<br><b>{$next list item(%searchtitles)}</b>") stop script Quote Link to post Share on other sites
botsimmer 16 Posted November 12, 2015 Author Report Share Posted November 12, 2015 Thank you - that is spot on. 1 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.