Script for DYNDNS Update

hi guys, i would like to know if anyone can help me with to figure out an script. kinda hard =/
first of all i have to explain why, so here we go:

i bought a time capsule, and i had the intention to use it as a file server. i did all i could to make it functional, and now it works just fine. But i had to set up a global hostname domain to access it from the dyndns.

somehow the dyndns don’t refresh the IP automatically and i dont know why. i’ve tried to set up the dyndns account on the time capsule and on the dlink but its just doesn’t work, so i had an idea, there it is:

Since i’m able to see the time capsule as a “remote airport base station” i would like to code a script that enable me to get the external IP from it (which is on my own house network) and update this IP in the dyndns website/client using my mac, so that way i can be able to connect to the time capsule using the global hostname domain I’ve created.

also i would like to the drives attached to the time capsule.

thank you all for reading!

Model: MBP Retina 15"
Browser: Safari 536.29.13
Operating System: Mac OS X (10.8)

Save this as a stay-open application and add it to your startup items. It will update periodically as long as it’s running.

property hostname : ""
property dyndnsUsername : "loginname"
property dyndnsPassword : "mypassword"
property myLastIP : missing value
property retryPeriod : 21600 -- Update period, in seconds

on run
	my updateDynDNS(myLastIP)
end run

on idle
	my updateDynDNS(myLastIP)
	set myLastIP to result
	return retryPeriod
end idle

on updateDynDNS(oldIP)
	-- get external ip address
	do shell script "curl [url=]"[/url]
	set myExternalIP to result
	if myExternalIP is not equal to oldIP then
		-- update dyndns
		do shell script "curl -v -k -u " & dyndnsUsername & ":" & dyndnsPassword & " \"" & hostname & "&myip=" & myExternalIP & "\""
		return myExternalIP
		return oldIP
	end if
end updateDynDNS

thank you very much! =]

hope this works! i will test as soon as i get home and tell u the result!