brought to you by SnipSnap
[ start | index | login ]
start > Dave > Using Dyndns

Using Dyndns

Created by Dave. Last edited by Dave, one year and 71 days ago. Viewed 44 times. #7
[diff] [history] [edit] [rdf]
labels
attachments
info.gif (256)
whatismyip.tcl (1020)

Using Dyndns

What is my site address?

Useful question, this is how I answer it on my windows systems. Its a TCL/TK script that invokes the windows XP shell command ping.

info As noted, I use an information graphic to decorate the box. This is not part of activestate's tcl/tk distribution, and thus needs to be copied to $tklibrary/images.

I am not happy with the triming of the ip address, which is displayed into the address variable using square brackets. Since these have a specific syntactical meaning, I can't find the syntax to remove them from the string.

wm title . {Query site ip?}
wm iconname . {Query site ip?}
wm geometry . 225x65+500+100

# This is not part of the package, it needs to be copied here image create photo infopic -file [file join $tk_library images info.gif]

set pingreply {} # windows XP set pingreply [exec ping -n 1 davelevy.dyndns.info] set address [ lindex $pingreply 2 ] # only tested on one ip address, do I always need to subtract two from length # to remove the first and last. What is the syntax to remove leading and trailing []. set daddress [string range $address 1 [expr [ string length $address ] - 2]]

set messagetext " public tcp/ip no : $daddress" set buttontext " Done "

frame .top frame .bottom

label .top.icon -image infopic frame .top.f -width 50 label .top.f.mess -text $messagetext

pack .top.f.mess -side top -fill x pack .top.icon .top.f -side left

button .bottom.dismiss -text $buttontext -command "exit" pack .bottom.dismiss pack .top .bottom

proc exit {} { destroy . }

Sadly the highlighter is Java, not tcl.

Chris advises that

set daddress [string trim $address {[]} ]

removes the brackets from the address and is obviously much neater and is character based. It implements a remove the unwanted character rule, not remove the first and last characters.

no comments | post comment
Subscribe using a feed reader.

Subscribe


short URL : >>http://is.gd/4L32o

Search my Site with Google

or use this site's >>top level tags, or the snipsnap-search tool.

Logged in Users: (2)
… and a Guest.



< November 2009 >
SunMonTueWedThuFriSat
1234567
891011121314
15161718192021
22232425262728
2930


XHTML 1.0 validated
CSS validated
RSS 2.0 validated
RSS Feed

Powered by SnipSnap 1.0b3-uttoxeter

Describe here what your SnipSnap is about!

Configure this box!

  1. Login in
  2. Click here: snipsnap-portlet-2
  3. Edit this box
snipsnap.org | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt