Aqua-Soft Forums: Can avescripter handle regular html ? (as opposed to xml) - Aqua-Soft Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Can avescripter handle regular html ? (as opposed to xml) Rate Topic: -----

#1 User is offline   garcia Icon

  • Group: Member
  • Posts: 53
  • Joined: 21-January 06

Posted 10 May 2006 - 12:55 PM

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

#2 User is offline   AndreasV Icon

  • Group: Developers
  • Posts: 2,137
  • Joined: 22-November 03

Posted 10 May 2006 - 01:10 PM

using the xmlhttprequest object, it's possible.
0

#3 User is offline   garcia Icon

  • Group: Member
  • Posts: 53
  • Joined: 21-January 06

Posted 10 May 2006 - 01:18 PM

AndreasV said:

using the xmlhttprequest object, it's possible.


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

Garcia.
0

#4 User is offline   pcm Icon

  • Group: Member
  • Posts: 617
  • Joined: 02-May 05

Posted 10 May 2006 - 01:34 PM

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
0

#5 User is offline   garcia Icon

  • Group: Member
  • Posts: 53
  • Joined: 21-January 06

Posted 10 May 2006 - 03:28 PM

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

#6 User is offline   pcm Icon

  • Group: Member
  • Posts: 617
  • Joined: 02-May 05

Posted 10 May 2006 - 03:37 PM

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

#7 User is offline   garcia Icon

  • Group: Member
  • Posts: 53
  • Joined: 21-January 06

Posted 10 May 2006 - 04:11 PM

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

#8 User is offline   pcm Icon

  • Group: Member
  • Posts: 617
  • Joined: 02-May 05

Posted 10 May 2006 - 04:26 PM

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
0

#9 User is offline   garcia Icon

  • Group: Member
  • Posts: 53
  • Joined: 21-January 06

Posted 10 May 2006 - 06:03 PM

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

#10 User is offline   pcm Icon

  • Group: Member
  • Posts: 617
  • Joined: 02-May 05

Posted 10 May 2006 - 06:26 PM

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

#11 User is offline   garcia Icon

  • Group: Member
  • Posts: 53
  • Joined: 21-January 06

Posted 10 May 2006 - 06:50 PM

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

#12 User is offline   AndreasV Icon

  • Group: Developers
  • Posts: 2,137
  • Joined: 22-November 03

Posted 10 May 2006 - 09:24 PM

Quote

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

#13 User is offline   garcia Icon

  • Group: Member
  • Posts: 53
  • Joined: 21-January 06

Posted 10 May 2006 - 11:29 PM

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

Garcia.
0

#14 User is offline   pcm Icon

  • Group: Member
  • Posts: 617
  • Joined: 02-May 05

Posted 11 May 2006 - 02:02 PM

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

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

#15 User is offline   garcia Icon

  • Group: Member
  • Posts: 53
  • Joined: 21-January 06

Posted 11 May 2006 - 06:21 PM

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

Any ideas?
0

#16 User is offline   pcm Icon

  • Group: Member
  • Posts: 617
  • Joined: 02-May 05

Posted 11 May 2006 - 06:56 PM

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'))
0

#17 User is offline   garcia Icon

  • Group: Member
  • Posts: 53
  • Joined: 21-January 06

Posted 11 May 2006 - 09:13 PM

ok thanks pcm,
that works a treat!
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic