Jump to content
UBot Underground

Pass A Javascript Variable From Ubot "ui Html Panel" To Ubot Define/variable


Recommended Posts

Hey there fellow UBotters, .. 

Im having a crisis and hoping that someone can shed some light on something for me :)

 

 

What i am trying to do is so simple its annoying, ..

 

I have a listbox in a UI HTML "Panel" which Im trying to make "Multi selection", now i am painfully aware that only 1 value can/will be passed via the UBot variable set within the listbox code, 

and indeed using javascript, a browser and "console.log()" have it exactly how i want it, .. perfect right ? ... NOPE :(

 

 

I didnt think it would initially be a problem as i have used exactly the same process to extract/pass variables from within a Load HTML 1001 times ... 

However using a UI HTML "Panel" I can NOT seem to get the javascript var to pass over to a UBot var, .. 

 

 

 

here's what i got .....

 

The code im using to set the javascript variable :

http://i.imgur.com/61J3zHK.jpg

 

Here is the code working in a browser showing the multi-selection working great in the console.log :

https://youtu.be/TLEQGuUGvFw

 

 

And here is the UBot variable/set that will work in Load HTML but not UI HTML Panel :

set(#MReady,$eval("MSel"),"Global")

Ive also used this in Load HTML but no success in UI Panel :

set(#MReady,$eval("document.getElementById('addimager998816').options[addimager998816.selectedIndex].value;"),"Global")

Am i missing something ? ... something necessary for it to work in a UI "Panel" ?

 

Any help or a point in the right direction would be greatly appreciated :)

 

 

 

Cheers

CJ

Link to post
Share on other sites

the ubot eval method only works on the main browser window

 

check out a post I made on Eval UI method,it straight converts most ubot ui commands(all but some just dont work) into code to put into your own html panel,and great for debugging too

 

the code for the ui list box is this,this creates a variable called selection

ui html panel("<div class=\"uielement\">listbox<br><select size=\"4\" variable=\"#selection\" fillwith=\"value\"><option value=\"this\">this</option><option value=\"that\">that</option><option value=\"other\">other</option></select></div><",200)

  • Like 1
Link to post
Share on other sites

the ubot eval method only works on the main browser window

 

check out a post I made on Eval UI method,it straight converts most ubot ui commands(all but some just dont work) into code to put into your own html panel,and great for debugging too

 

the code for the ui list box is this,this creates a variable called selection

ui html panel("<div class=\"uielement\">listbox<br><select size=\"4\" variable=\"#selection\" fillwith=\"value\"><option value=\"this\">this</option><option value=\"that\">that</option><option value=\"other\">other</option></select></div><",200)

 

 

Thanks deliter, your a star :)

there may be hope yet,

 

Im not sure how i managed to miss that particular thread, .. I searched long enough lmao

 

 

Ill have a play about with it and see where it goes, .

Thanks again

 

 

Cheers

CJ

  • Like 1
Link to post
Share on other sites
  • 8 months later...

Since 72 hrs I am stuck in the same problem. Tried many ways to overcome this, but it seems that passing JS to UBot variable in UI HTML Panel is a real shortcoming.

 

If anyone has found a solution, please advise.

Link to post
Share on other sites
  • 6 months later...
  • 2 years later...

I know this is a bit of an old thread, but I wanted to take a moment to post a reply here with a useful piece of actionable information that was very recently helpful for me, and which may be relevant and helpful for others in the future.

 

In October 2016 'deliter' mentions:

 


check out a post I made on Eval UI method,it straight converts most ubot ui commands(all but some just dont work) into code to put into your own html panel,and great for debugging too

 

I think this is the post that was being referenced above:

http://network.ubotstudio.com/forum/index.php/topic/19678-eval-ui-html-panel-method/?p=128633

 

Thank you for that post!

 

Here's the key takeaway that I wanted to share in this thread, which shows up in search engines when someone looks up "how to pass a JavaScript variable from the UBot ui html panel to a native UBot variable."

 

Here's how you can set the value of a native UBot Studio variable from within the "ui html panel" via JavaScript:

 

ubot.runScript('set(#NativeUBotVariable,"'+TheJavaScriptVariable+'","Global")')
 
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...