Jump to content
UBot Underground

What happened to Javascript?


Recommended Posts

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.

 

 

Link to post
Share on other sites

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

Link to post
Share on other sites

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.

Link to post
Share on other sites

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.

Link to post
Share on other sites

hi chainsaw

 

i see you haven't been here for a while so i won't give ya a hard time :D

 

 

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

Link to post
Share on other sites
  • 3 weeks later...

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.

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...