dyvel 20 Posted January 27, 2015 Report Share Posted January 27, 2015 I have created this little example code using Aymen's very nice ini plugin, and while the example works, I'm interested in learning how I can pass the values from #section names into a drop down in a UI HTML panel. I have considered building the html in a loop and pass that to a variable that is read by the HTML panel. Seems like a work around.Next, how would I pass the selected value to a define. Is it a javascript job? on load("Bot Loaded") { set(#ini_file,"{$special folder("Desktop")}/test.ini","Global") } ui button("Create ini file") { plugin command("IniFileReader.dll", "ini container", #ini_file) { plugin command("IniFileReader.dll", "ini write", "Profile 1", "profilename", "John Doe") plugin command("IniFileReader.dll", "ini write", "Profile 1", "Site", "http://www.google.com") plugin command("IniFileReader.dll", "ini write", "Profile 2", "profilename", "Jane Doe") plugin command("IniFileReader.dll", "ini write", "Profile 2", "Site", "http://www.bing.com") set(#section names,$replace($plugin function("IniFileReader.dll", "$ini get section names"),$new line,","),"Global") } } ui drop down("Section names",#section names,#selected_profile) ui button("Load ini params") { plugin command("IniFileReader.dll", "ini container", #ini_file) { set(#section_site,$plugin function("IniFileReader.dll", "$ini read", #selected_profile, "Site"),"Global") } } ui stat monitor("Selected section:",#selected_profile) ui stat monitor("Section site",#section_site) Quote Link to post Share on other sites
dyvel 20 Posted January 27, 2015 Author Report Share Posted January 27, 2015 Tried this example provided by jason: http://www.ubotstudio.com/forum/index.php?/topic/15102-solved-who-else-wants-the-optgroup-tag-to-be-fixed/?p=85657 set(#options,"one,2,3,four","Global") ui html panel("<select variable=”#result” list=”#options” list-fillwith=“options”> </select>",100) Seems like a great solution, but can't get it to work even though I use the same example code - a bug perhaps? Quote Link to post Share on other sites
dyvel 20 Posted January 27, 2015 Author Report Share Posted January 27, 2015 For some reason the html wasn't "escaped" correctly - fixed it and modified my profile example using the ini plugin. Working example provided here on load("Bot Loaded") { set(#ini_file,"{$special folder("Desktop")}/test.ini","Global") Create ini file() } ui html panel("<select variable=\"#selected_section\" list=\"#section_names\" list-fillwith=\"options\"></select> <input type=\"button\" value=\"Load ini params\" class=\"btn\" onclick=\"ubot.runScript(\'Load ini params()\')\"></button>",100) define Create ini file { alert("Creating ini file") plugin command("IniFileReader.dll", "ini container", #ini_file) { plugin command("IniFileReader.dll", "ini write", "Profile 1", "profilename", "John Doe") plugin command("IniFileReader.dll", "ini write", "Profile 1", "Site", "http://www.google.com") plugin command("IniFileReader.dll", "ini write", "Profile 2", "profilename", "Jane Doe") plugin command("IniFileReader.dll", "ini write", "Profile 2", "Site", "http://www.bing.com") set(#section_names,$replace($plugin function("IniFileReader.dll", "$ini get section names"),$new line,","),"Global") } } define Load ini params { plugin command("IniFileReader.dll", "ini container", #ini_file) { set(#section_site,$plugin function("IniFileReader.dll", "$ini read", #selected_section, "Site"),"Global") } alert("Selected section value: {#section_site}") } Quote Link to post Share on other sites
dyvel 20 Posted January 27, 2015 Author Report Share Posted January 27, 2015 now... sleep 1 Quote Link to post Share on other sites
ianshier 1 Posted February 16, 2015 Report Share Posted February 16, 2015 Tried this example provided by jason: http://www.ubotstudio.com/forum/index.php?/topic/15102-solved-who-else-wants-the-optgroup-tag-to-be-fixed/?p=85657 set(#options,"one,2,3,four","Global") ui html panel("<select variable=”#result” list=”#options” list-fillwith=“options”> </select>",100) Seems like a great solution, but can't get it to work even though I use the same example code - a bug perhaps?How did you solve this problem?I have the same with a strange variable Quote Link to post Share on other sites
darryl561 177 Posted February 18, 2015 Report Share Posted February 18, 2015 That code is missing the back slashes(needed if pasting code into code view). Paste the code below into code view: set(#options, "one,2,3,four", "Global") ui html panel(" <select variable=\"#result\" list=\"#options\" list-fillwith=\"options\"> </select> </html> ", 100) 1 Quote Link to post Share on other sites
ianshier 1 Posted February 19, 2015 Report Share Posted February 19, 2015 Doesn't work anyway. Quote Link to post Share on other sites
dyvel 20 Posted February 19, 2015 Author Report Share Posted February 19, 2015 Try and share some of you code - makes it easier to help Quote Link to post Share on other sites
darryl561 177 Posted February 19, 2015 Report Share Posted February 19, 2015 Doesn't work anyway. Mate if you can't get the code to work don't just come here and say it does'nt work. Share what your doing here like dyvel said. The code DOES WORK. I'm not gonna paste code here if it does'nt work. See for yourself: http://screencast.com/t/gNIOPGSEtI Quote Link to post Share on other sites
Kreatus (Ubot Ninja) 422 Posted February 19, 2015 Report Share Posted February 19, 2015 Mate if you can't get the code to work don't just come here and say it does'nt work. Share what your doing here like dyvel said. The code DOES WORK. I'm not gonna paste code here if it does'nt work. See for yourself: http://screencast.com/t/gNIOPGSEtI Yes it definitely worked!Didnt know it's that simple.. Thanks! Do you guys know how to trigger a define when you select a certain option on your dropdown menu?I tried to put an onclick code on the option tag but it seems to be ignored. Quote Link to post Share on other sites
ianshier 1 Posted February 19, 2015 Report Share Posted February 19, 2015 http://screencast.com/t/UYmY6JqfIHgzany ideas? Quote Link to post Share on other sites
darryl561 177 Posted February 19, 2015 Report Share Posted February 19, 2015 http://screencast.com/t/UYmY6JqfIHgzany ideas? Can't see the entire code but I assume you just copy and pasted from above so unfortunately I don't understand why it's not working for you. Quote Link to post Share on other sites
ianshier 1 Posted February 19, 2015 Report Share Posted February 19, 2015 I copied exactly the same code which you do.Maybe it somehow depends of windows version?UI drop down works with dynamic variables, but it's impossible to put them into program, when my all gui is in HTML, right? Quote Link to post Share on other sites
dyvel 20 Posted February 19, 2015 Author Report Share Posted February 19, 2015 I copied exactly the same code which you do.Maybe it somehow depends of windows version?UI drop down works with dynamic variables, but it's impossible to put them into program, when my all gui is in HTML, right? My GUI is all HTML and I load the dynamic dropdown values as shown in my post #3Have you checked you have values in your variable (check debugger). Again - post some code - makes it easier to help Quote Link to post Share on other sites
ianshier 1 Posted February 19, 2015 Report Share Posted February 19, 2015 I posted a video, which shows you my debugger and variables. I know that you had same problem, how did you solve it? 1 Quote Link to post Share on other sites
Kreatus (Ubot Ninja) 422 Posted February 20, 2015 Report Share Posted February 20, 2015 Do you guys know how to trigger a define when you select a certain option on your dropdown menu?I tried to put an onclick code on the option tag but it seems to be ignored. Just answering my own question here. Some members might be interested. Here's the link http://www.ubotstudio.com/forum/index.php?/topic/17629-free-code-selected-dropdown-menu-item-to-execute-a-define/ Quote Link to post Share on other sites
ianshier 1 Posted February 21, 2015 Report Share Posted February 21, 2015 Maybe I haven't got a plugin. Can you show me what plugins you have turned on? Quote Link to post Share on other sites
great2bme 5 Posted April 1, 2015 Report Share Posted April 1, 2015 Worked great. Thanks! UPDATE: found that when I copied this simple code over to an existing UBOT that already had other UI OPEN FILE and UI STAT MONITOR commands, my drop-down menu is blank - no options (similar to ianshier's video). I removed all other UI OPEN FILE and UI STAT MONITOR commands and the dropdown menu populated correctly. It doesn't appear they can coexist. Quote Link to post Share on other sites
brusacco 20 Posted October 25, 2017 Report Share Posted October 25, 2017 Hello,Where do you get LIST and LIST-FILLWITH options? I have searched the docs online and did not get those. Thanks. Quote Link to post Share on other sites
HelloInsomnia 1103 Posted October 25, 2017 Report Share Posted October 25, 2017 Hello,Where do you get LIST and LIST-FILLWITH options? I have searched the docs online and did not get those. Thanks. Those are added to the HTML code when you make a UI using the ui html panel. I don't think there is any real documentation on it just something people have pointed out on the forum. Not 100% sure what you're asking but if you're wondering if they are in Ubot they are not, you need to type them into the HTML directly. Quote Link to post Share on other sites
brusacco 20 Posted October 26, 2017 Report Share Posted October 26, 2017 Hello,Thanks, yes I know, they are to be used in the HTML of the UI. I just can find any reference other than this forum. That's a very helpful option, or you have to iterate a list and format an innerhtml code, etc. I have this option now: <select id="mys" list="#listado" list-fillwith="options" class="form-control" multiple> </select> And I need to run this one every time the select changes: <script type="text/javascript"> $("#mys").change(function() { ubot.runScript("updateBox(" + $('#mys').val() + ")"); }); </script> The point is to store the multiple values selected in the select to another place, to use those options from there. As far as I know Ubot don't store multiple values from a select, right? That runScript is not working for me right now, I have placed a Navigate in the define(to test it), and it never gets executed. The define store the "value" in the needed Ubot variable like this: define updateBox(#valores) { set(#gruposdisplay,#valores,"Global") } Thanks for the help! Quote Link to post Share on other sites
brusacco 20 Posted October 26, 2017 Report Share Posted October 26, 2017 <select id="mys" list="#listado" list-fillwith="options" class="form-control" multiple onchange="doIt();"> </select> <script type="text/javascript"> function doIt(){ ubot.runScript("updateValues(" + JSON.stringify($("#mys").val().join(", ")) + ")"); } </script> I get it working using this. Well now I can use a SELECT multiple, and store those values elsewhere to use them in the ubot code. 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.