Can avescripter handle regular html ? (as opposed to xml)

Here's an interesting one for you:

Is it possible to use avescripter to access a regular html page (as opposed to xml)?

In particular I would like to access my IP adress from my routers webpage.

Thanks,

Garcia.

#387534

using the xmlhttprequest object, it's possible.

#387536

using the xmlhttprequest object, it's possible.

Thanks Andreas,

where can I find out more about this object and how to use it?

Garcia.

#387538

You can also get the HTML stuff using Desklet.IO.URLToFile('HTTP',FileName)

Then you could read the resulting text file.

I don't have any examples of this, but I do remember this working when I coded it in awhile back.

You should be able to read the text file like a string if you just open it with Desklet.IO.GetTextFile()

Remember you can you %TMP% to represent the temp directory path

#387542

Thanks very much pcm,

I tried the following in the javascript file:

  Desklet.IO.URLToFile('http://192.168.1.1/doc/online.sht','C:Routerfile.txt')

but it doesn't seem to do anything. The web link does require username/password but I've input those into the avescripter properties tab. Anything I'm doing wrong?

Garcia.

#387561

Oh... I don't have support for password protected sites for that command.

I'll have to add it to the "todo" list.

The properties tab is for the proxy server if your using one.

#387563

Ok thanks very much pcm,

it would be a nice thing to have since e.g. routers are password protected.

Rather than hammering whatsmyip.org I thought it would be much more polite to interrogate the router instead.

Garcia.

#387571

that sounds like a good suggestion and I'll try to do it for the next "beta" update. so that you can do your stuff :)

I just remembered. Have you tried to put in the user name password directly in the http?

hddp://admin:Password@192.168.0.1

#387573

well for the moment I can't get the command to work at all. If for example I try

 IO.URLToFile('http://www.google.co.uk','C:Routerfile.txt')

I don't get anything (btw if I precede with "Desklet." I get an error).

Garcia.

#387585

desklet lower case. If your using Javascript.

you need to type the name of the page too I belive.

IO.URLToFile('http://www.google.co.uk/index.html','C:Routerfile.txt')

I don't think httprequest is smart enough to redirect. Those are MS APIs.

#387593

WOW it worked!

I used your suggestion of putting the username/pass in the http. That works very nicely thanks!

Ok so now I have a 15k text/html file with key bits of information in at various points (e.g. IP address).

How do I go about extracting the right information?

EDIT: ok I've found out how to do pattern matching in javascript. All thats left is file i/o. Any help much appreciated.

Thanks very much for your help pcm,

I can see a router monitoring app coming on.

;)

Garcia.

#387595

IO.URLToFile('http://www.google.co.uk/index.html','C:Routerfile.txt')

Just a small side remark: always put files in one of the TEMP directories (for the release version), 'cause that's the only directories non-admins always have access to.

#387633

Ok thanks Andreas - I was going to ask you that! You've saved me the trouble.

Garcia.

#387657

That's why I mentioned %TMP% but I should have said %TMPPATH%

IO.URLToFile('http://www.google.co.uk/index.html','%TMPATH%Routerfile.txt')

#387793

Hmm neither %TMPPATH% nor %TMPATH% seem to have the desired effect. All that happens is the file gets called that literally.

Any ideas?

#387858

Hmm..

Looks like I missed that command to convert automatically.

You can do a manual convert by doing the following

IO.URLToFile(ConvertToValue('http://www.google.co.uk/index.html','%TMPATH%Routerfile.txt'))

#387869

ok thanks pcm,

that works a treat!

#387914