Jump to content
UBot Underground

Progress Bar With Next Button


Recommended Posts

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.

Link to post
Share on other sites

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.

Link to post
Share on other sites

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 completed

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.

Link to post
Share on other sites

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

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...