Anonym 53 Posted January 28, 2012 Report Share Posted January 28, 2012 I am fiddling with the UI nodes, especially the UI listbox, to see if they can be populated on the fly in runtime. I know this can be done with a UI HTML Panel and I do have the Dev version, but that's not it. I am trying to do it with the regular UI nodes. After my tests it looks like it works to populate UI nodes on the fly, well not completely, but partially.Have a look at the below script. The script is just for testing purposes where I try different things of the UI nodes: comment("Just a static list box") ui list box("Some Countries", "USA,Canada,Mexico,Russia,Niue", #country) comment("Let\'s monitor the variable that reads the Nordic countries.") ui stat monitor("otherCountries", #otherCountries) comment("Just set the read-in variable to nothing") set(#otherCountries, "", "Global") wait(2) clear list(%countries) comment("Ok, so let\'s read the Nordic countries") add list to list(%countries, $list from file("http://botshop.org/products/common/other-countries.txt"), "Delete", "Global") comment("...and then format it so it fulfills the requirements of a UI listbox.") set(#otherCountries, $text from list(%countries, ","), "Global") comment("Now the things that are supposed to not work, starts working - well, partially, it needs to refresh the UI part of the screen. is there such a command or workaround that can be automated?") ui list box("Nordic Countries", #otherCountries, #myTest) comment("This is also odd, a static UI component can have it\'s label as a variable that is read in run-time. And it works without refreshing the UI part of the screen.") ui stat monitor(#otherCountries, #otherCountries) set(#i, 0, "Global") comment("Well, this doesn\'t work, but it\'s not needed.") loop(20) { ui stat monitor(#i, #otherCountries) increment(#i) } (Each comment in the script above refers to the line just below the comment.) So, it appears that a UI stat monitor can be changed on the fly (that is, populating it in runtime) (and of course I don't mean the variable that it monitors, but the label you can set to clarify what the monitoring is about). When it comes to populating the UI Listbox it can be done only if the UI gets refreshed, like having the above code in one tab and run it, then go over to another tab and then back again. I also managed to get a refresh after running it, then bringing up the debugger, just to close it again. I have tried other ways to fresh the UI area, but no luck sofar in doing it in a way that can be used in a fancy way, but maybe some of you know how to accomplish the refresh!? Quote Link to post Share on other sites
Legend 181 Posted January 28, 2012 Report Share Posted January 28, 2012 So, it appears that a UI stat monitor can be changed on the fly (that is, populating it in runtime) (and of course I don't mean the variable that it monitors, but the label you can set to clarify what the monitoring is about).This is cool... http://ubotstudio.com/forum/public/style_emoticons/default/smile.gif Quote Link to post Share on other sites
Anonym 53 Posted January 28, 2012 Author Report Share Posted January 28, 2012 I asked about this and was told that UI drop/list boxes cannot be set after the initialize (when the UI is loaded.. as you said, on program launch or tab change) because it does not serve a purpose in "web automation" to set contents. Yes, I know. I have asked for it too, and I do think it serves a purpose. I just made these tests to see if it was possible anyway. Which on one hand I understand, as it does go against the idea of automation... Asking somebody to select something different after they've already clicked Run. It doesn't need to be like that. Assume that your customer wants to access a set of services and that the amount of services get altered from one time to another, the behaviour of the services might be the same, it's just that the list of sites gets altered. You publish the list of sites on your website and you want your customer to be able to access the latest services (one, some or all) without even knowing that their bot is in fact asking your website for the latest list of services, which in turn would populate the UI listbox. The customer only wants to be able to select which services they want to access. UBot based bots would become so much simple to maintain if this was possible. 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.