tooltrainer 12 Posted August 31, 2010 Report Share Posted August 31, 2010 Pretty sure this has been discussed before but the forum search functions blow and I couldn't find it. So, I need to get the output of a javascript and check it in UBot. How do I get this into a UBot variable? Here's the JS: theDate = new Date();var smallYear = theDate.getYear().toString().slice(2); So I need to get the value of smallYear (a 2 digit year) into a UBot variable. Thanks in advance! Jonathan Quote Link to post Share on other sites
tooltrainer 12 Posted August 31, 2010 Author Report Share Posted August 31, 2010 Strike that, found the answer in this thread: http://ubotstudio.com/forum/index.php?/topic/3703-how-do-i-get-output-from-javascript Turns out you can simply stick a javascript into an $eval and it will evaluate into whatever UBot variable you want it to go to. Only trick is you have to end the JS code with just your final resulting variable. My final code looks like this: theDate = new Date(); var smallYear = theDate.getYear().toString().slice(2); smallYear; Thanks! Jonathan 1 Quote Link to post Share on other sites
Praney Behl 314 Posted August 31, 2010 Report Share Posted August 31, 2010 Strike that, found the answer in this thread: http://ubotstudio.com/forum/index.php?/topic/3703-how-do-i-get-output-from-javascript Turns out you can simply stick a javascript into an $eval and it will evaluate into whatever UBot variable you want it to go to. Only trick is you have to end the JS code with just your final resulting variable. My final code looks like this: theDate = new Date(); var smallYear = theDate.getYear().toString().slice(2); smallYear; Thanks! Jonathan Nice one! It was helpful, I was also looking for some like this.. 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.