Jump to content



Photo

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

javascript js ui ui html panel variable

  • Please log in to reply
6 replies to this topic

#1 cүвεя_נυηкιε

cүвεя_נυηкιε

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 527 posts
  • LocationRight behind you !
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v3.5 & v4.0
  • License:Developer Edition

Posted 20 October 2016 - 05:26 AM

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 :

61J3zHK.jpg

 

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

 

 

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


6S5zncI.jpg


#2 deliter

deliter

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 613 posts
  • OS:Windows 8
  • Total Memory:More Than 9Gb
  • Framework:v4.0
  • License:Developer Edition

Posted 20 October 2016 - 10:48 AM

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)



#3 cүвεя_נυηкιε

cүвεя_נυηкιε

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 527 posts
  • LocationRight behind you !
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v3.5 & v4.0
  • License:Developer Edition

Posted 20 October 2016 - 11:00 AM

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


6S5zncI.jpg


#4 PRO

PRO

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 169 posts
  • Locationeurope
  • OS:Windows 7
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 20 June 2017 - 04:32 PM

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.



#5 PRO

PRO

    Advanced Member

  • Fellow UBotter
  • PipPipPip
  • 169 posts
  • Locationeurope
  • OS:Windows 7
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 21 June 2017 - 12:44 PM

Try to put all JS / jQuery directly below the closing </body> tag.

 

This has resolved it for me.



#6 hare ram

hare ram

    Advanced Member

  • Members
  • PipPipPip
  • 139 posts
  • LocationNew Delhi
  • OS:Windows 10
  • Total Memory:8Gb
  • Framework:v4.0
  • License:Professional Edition

Posted 03 January 2018 - 01:48 AM

i am facing same pro to click submit button to scrape in youtube channel detail for scraping contact details. 



#7 stephenzeiner

stephenzeiner

    Advanced Member

  • Members
  • PipPipPip
  • 32 posts
  • OS:Mac OS
  • Total Memory:8Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 22 June 2020 - 07:37 PM

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.ubots...ethod/?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")')
 





Also tagged with one or more of these keywords: javascript, js, ui, ui html panel, variable

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users