1nspire 5 Posted January 13, 2010 Report Share Posted January 13, 2010 Ok I have a little script that scrapes data and saves to csv. I would really like the compiled bot to output the table of results in the ubot browser window. I attempted to use Jim's javascript overlay method http://ubotstudio.com/forum/index.php?/topic/2326-blanking-out-webpage-in-ui/ but with no luck. I guess when it all said and done. The dev tool needs some control over the compiled bots. How data is handled and outputted to the user besides saving to files. Quote Link to post Share on other sites
Guest Jim Posted January 13, 2010 Report Share Posted January 13, 2010 First, build your table. Something like this:set #table -> "<table><tr><th>Column 1</th><th>Column 2</th></tr>" loop $list total %list1 { set #table -> #table + "<tr><td>" + nextlistitem(%list1) + "</td><td>" + nextlistitem(%list2) + "</td></tr>" } set #table -> #table + "</table>"; and then use my overlay example and put the value of #table in for the value for innerHTML. I hope that makes some sense! I might've over-simplified it. Quote Link to post Share on other sites
1nspire 5 Posted January 13, 2010 Author Report Share Posted January 13, 2010 Thanks Jim. I still did not get it to work. If you have time would you please show me a working model in ubot. I am a complete javascript dumbass. I definitely see a need for me to learn javascript so consider my butt in school. Quote Link to post Share on other sites
Guest Jim Posted January 13, 2010 Report Share Posted January 13, 2010 Here's a working example Let me know if you have any questions. This is by no means the 'best' solution to outputting data for the user, but it works. table_of_data.ubot And here's some sample data and it's output: Maybe I should turn my little overlay function into a library of sorts. I'll have to think that out. Quote Link to post Share on other sites
1nspire 5 Posted January 13, 2010 Author Report Share Posted January 13, 2010 That is great Jim. A couple of things I noticed. The overlay seems to have trouble dealing with .png images so I need a blank page to nav to before the overlay. Second, depending on the ubot window size is what the overlay will show. Meaning you cannot scroll if your list is longer than the browser window. When you said that this is not the best solution for outputting data what would you suggest? Quote Link to post Share on other sites
Aaron Nimocks 19 Posted January 13, 2010 Report Share Posted January 13, 2010 When you said that this is not the best solution for outputting data what would you suggest? The best solution in my opinion would be to navigate to a page on one of your sites. Have a texarea form field where you change the attribute to the HTML output you want. So pretty much like Jim said but enter it in a form then submit. When the page refreshes/loads then it will just display the HTML on the page. That way you have full control over what you want to see. Quote Link to post Share on other sites
1nspire 5 Posted January 13, 2010 Author Report Share Posted January 13, 2010 Yes that was an idea I had. Then I could have some other nice features like link some table data to affiliate sites and so on. But where this is going is that I found a tool that was similar to what I made but all of the bot functions where hidden. When the bot finished it outputted directly into the tool with a nice easy to read, styled table. I did some javascript snooping around and found that if I use document.write("{1}"); instead of using Jim's overlay I got the output plus a scroll bar for long list. From what I can tell with document.write is I should be able to use html tags to make the table look better. Not sure if I can use the <style> tag though. On a side note what books do you guys recommend for javascript? Quote Link to post Share on other sites
Guest Jim Posted January 13, 2010 Report Share Posted January 13, 2010 Yes that was an idea I had. Then I could have some other nice features like link some table data to affiliate sites and so on. But where this is going is that I found a tool that was similar to what I made but all of the bot functions where hidden. When the bot finished it outputted directly into the tool with a nice easy to read, styled table. I did some javascript snooping around and found that if I use document.write("{1}"); instead of using Jim's overlay I got the output plus a scroll bar for long list. From what I can tell with document.write is I should be able to use html tags to make the table look better. Not sure if I can use the <style> tag though. On a side note what books do you guys recommend for javascript?document.write replaces the entire page when you first call it. You can put any html in it (even style tags). My overlay covers the page, leaving everything where it was so that you can still scrape, fill fields, and do anything you normally would on the page (except there may be some issues with captchas) Quote Link to post Share on other sites
1nspire 5 Posted January 14, 2010 Author Report Share Posted January 14, 2010 Excellent Jim, thanks again for your help. Quote Link to post Share on other sites
Aaron Nimocks 19 Posted January 14, 2010 Report Share Posted January 14, 2010 Another thought might be to save the HTML to file. Just like saving to a .txt just save to .html in My Documents or where ever. Then browse to the offline .html If this is some type of status report of the scraping then it would work out perfect since it saves a record. Quote Link to post Share on other sites
1nspire 5 Posted January 14, 2010 Author Report Share Posted January 14, 2010 Yea Aaron that is a great option. I guess what I am getting at and would love to see ubot evolve to this point would be to have ubot dev tool create a compiled bot that when it is downloaded or ran from a cd it would have its own little windows based installation wizard to create the directory paths. Then the compiled bot would easily find any additional files or images that are required for the bot. Plus we would have a dedicated directory to save files to if the bot required it such as Licensing. Plus I would think this would aid in the ability that our compiled bots could be updated in a similar fashion like the dev tool. Maybe this is out of the scope of the current ubot, who knows, but man that would definitely be a great dev tool. Quote Link to post Share on other sites
bluegoat 24 Posted January 16, 2010 Report Share Posted January 16, 2010 Another thought might be to save the HTML to file. Just like saving to a .txt just save to .html in My Documents or where ever. Then browse to the offline .html If this is some type of status report of the scraping then it would work out perfect since it saves a record.How could we nav to a file on our system relative to the directory the bot is in? ex: Scrapes\test.txt I can nav to the absolute path ex: C:\Documents and Settings\xxx\My Documents\UBot\Scrapes\test.txtorfile:///C:/Documents and Settings/xxx/My Documents/UBot/Scrapes/test.txt 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.