Aqua-Soft Forums: How to display functions/variables in layers - Aqua-Soft Forums

Jump to content

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

How to display functions/variables in layers Rate Topic: -----

#1 User is offline   garcia Icon

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

Posted 11 May 2006 - 10:39 AM

One final question. In a layer, how do I display a variable/function (as opposed to fixed text)?

I know how to reference text, i.e.

src="!TXT:192.168.1.1"


but if I want to call a function such as getip() how do I display the result in a layer?

src = ???   getip()


Many thanks for your patience,
Garcia.
0

#2 User is offline   AndreasV Icon

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

Posted 11 May 2006 - 11:00 AM

src="!SCRIPT:getip()" maybe? :)
0

#3 User is offline   garcia Icon

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

Posted 11 May 2006 - 12:15 PM

AndreasV said:

src="!SCRIPT:getip()" maybe? :)


Doesn't seem to work unfortunately.
:(

Although you are right it is the desired command. I'll try tinkering.
0

#4 User is offline   nightcrawler1089 Icon

  • Group: Administrators
  • Posts: 7,909
  • Joined: 26-February 04

Posted 11 May 2006 - 12:17 PM

You've taken a look at the SDK, right?

-NC
0

#5 User is offline   garcia Icon

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

Posted 11 May 2006 - 01:23 PM

Yes you were right nightcrawler & Andreas.

Its working! It picks up my IP address from my router's password protected html page. Pretty amazing!

Only thing now is that it doesn't update (supposed to update every 6 secs)
Here's my timer:



the layer src is:

src="!SCRIPT:myip()"

and the first line of the script is:

desklet.IO.URLToFile('http://user:Pass@192.168.1.1/doc/online.sht','Routerfile.txt');

Unfortunately this file only gets updated once on start (instead of being updated every 6 seconds like it should).

EDIT 2: OK problem solved! It should be ontimer="this.Redraw()" in the timer.

It Works!! Thanks to Andreas & pcm for all their generous help.

Garcia.
0

#6 User is offline   pcm Icon

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

Posted 11 May 2006 - 01:58 PM

neither, its your code.

this.ForceXDataFetch() is for XML Data. Your not bound to XML stuff so what you should be doing is just redrawing the layer.


0

#7 User is offline   garcia Icon

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

Posted 12 May 2006 - 08:36 AM

You were right pcm - my silly mistake.

In case anyone wants to see the finished desklet it is here:
http://putfile.com/pic.php?pic=5/13015542375.jpg&s=f5

(along with avedock complete with hider button). As you can see it displays my ip, along with uptime, download connection speed and SNR. Refreshes every minute by default. In priciple any info can be displayed from the routers webpage, or indeed any other html webpage.

If anyone thinks its worth releasing then I'll do so. Although it currently works with my router (Draytek 2600), obviously it can be easily adapted to any router:

1. Load browser, save copy of router's webpage, load with text-editor (e.g. notepad++).
2. Locate the info you want to display (e.g. IP). Now find a unique string around that info (either before, after or both). Notepad++ comes in handy here because it tells you how many instances of any given string there are in the document.
3. Paste that string into main.js changing into a reg exp. (this is easy to do)
4. Also in main.js, put in your routers web address, username & pass.
5. And you are done!

Big thanks to pcm and ave.

Garcia.
0

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