Chainsaw 9 Posted January 12, 2013 Report Share Posted January 12, 2013 I'm trying to do some complex data manipulation and Javascript is the only practical way to do it. Been away from Ubot for a while as it had ...hmm.... stability issues last year. Now I'm back and for some reason, can't get the $eval function to return anything from Javascript. Not even a simple date function seems to work. define $dateYMD { return($eval(" var date = new Date(); date.getFullYear()+\'-\'+(date.getMonth() < 9 ? \'0\' : \'\') + (date.getMonth() + 1)+\'-\'+(date.getDate() < 10 ? \'0\' : \'\') + date.getDate();")) } alert($dateYMD())And the above function used to work fine. So any information on how to use javascript in ubot now, would be very useful. Thanks. Quote Link to post Share on other sites
pftg4 102 Posted January 12, 2013 Report Share Posted January 12, 2013 use set node and eval pftg4 Quote Link to post Share on other sites
pftg4 102 Posted January 12, 2013 Report Share Posted January 12, 2013 i also did a date tutorial might be easier depends on what format you want http://www.ubotstudio.com/forum/index.php?/topic/12342-a-little-help-with-the-new-year-date-breakdown-tutorial/ pftg4 Quote Link to post Share on other sites
blumi40 222 Posted January 12, 2013 Report Share Posted January 12, 2013 define $dateYMD { set(#myDate, $eval(" var date = new Date(); date.getFullYear()+\'-\'+(date.getMonth() < 9 ? \'0\' : \'\') + (date.getMonth() + 1)+\'-\'+(date.getDate() < 10 ? \'0\' : \'\') + date.getDate();"), "Global") return(#myDate)}alert($dateYMD Quote Link to post Share on other sites
pftg4 102 Posted January 12, 2013 Report Share Posted January 12, 2013 like i said pftg4 1 Quote Link to post Share on other sites
Chainsaw 9 Posted January 12, 2013 Author Report Share Posted January 12, 2013 Thanks pftg4. However the javascript date function was just an example of some javascript code that worked fine in Ubot a few months ago and now it does not. Has the ability to execute javascript been silently removed from Ubot? If so then it is 10 steps backwards. Fact is Ubot string handling is clumsy at best but that is fine as javascript used to be able to fill the voids in ubot's abilities. Quote Link to post Share on other sites
pftg4 102 Posted January 12, 2013 Report Share Posted January 12, 2013 just use set node with eval will do what you need Pftg4 Quote Link to post Share on other sites
Chainsaw 9 Posted January 12, 2013 Author Report Share Posted January 12, 2013 The $eval function appears to no longer return the results of javascript or perhaps javascript isn't being executed. This code doesn't even return a result. alert($eval("1;")) I see there is a new "allow javascript" command which doesn't seem to do anything but I think this is refering to javascript executing on the webpage. And there is a new "run javascript" command but there seems no way to return the results. Quote Link to post Share on other sites
pftg4 102 Posted January 12, 2013 Report Share Posted January 12, 2013 hi chainsaw i see you haven't been here for a while so i won't give ya a hard time javascript popups are disabled by default in ubot 4 go to google and try to do anything else and i'm sure it will work you need nothing other than set and eval if not it must be a bug pftg4 Quote Link to post Share on other sites
Chainsaw 9 Posted February 2, 2013 Author Report Share Posted February 2, 2013 Finally figured out the problem. Seems that javascript won't work until your bot has first navigated to a web page. You must navigate to a webpage before running any javascript. 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.