DTDNS Update Client v1.1

Example scripts and tips (replaces Old Scripts & Tips archive)

Moderators: Dorian (MJT support), JRL, Phil Pendlebury

Post Reply
User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

DTDNS Update Client v1.1

Post by CyberCitizen » Sun Jul 06, 2014 11:51 am

Hey Guys,

I have a dynamic IP address (eg changes on each connection). My ISP charge per month for a static IP (home user). Can't justify paying per month for an IP address. Imaging if your mobile company did that. New number every time your phone was restarted?

Anyway I have been using DynDNS for years with my Billion router until DynDNS stopped the free service. Moved over to DTDNS and they have been great. Problem is needed to change routers due to a fault and got a new NetComm via my ISP. It doesn't support DTDNS. Contacted NetComm and asked about getting it added to a firmware update. They advised its a superseded model and won't be getting any firmware updates.

So left with this I was forced to look at either a paid DynDNS account (to pricey for what they want), change to another modem (at my cost), look at a software update client (most are out of date or charge), or do what any good Macro Scheduler user does and write my own.

Please note Passwords & API keys removed (replaced with XXXXXX). Each router displays the internet ip address in different locations, please modify accordingly.
Let>MSG_HEIGHT=320
Let>MSG_WIDTH=500
Let>MSG_STAYONTOP=1
Let>MSG_CENTERED=1

//Sets Application Name Based On What The Executable Is Called
ExtractFileName>Command_Line,strFileName
ExtractFileExt>Command_Line,strExt
StringReplace>%strFileName%,",,strFileName
StringReplace>%strExt%,",,strExt
StringReplace>%strFileName%,%strExt%,,strFileName
Trim>%strFileName%,strFileName
Let>APP_TITLE=%strFileName%
Let>WLN_NOCRLF=1

//Starts Main Checking Part Of Script Checking Every 90 Seconds
Label>Start
GoSub>sCheckInternetIP
If>%vHTML%=404 Error connecting to host
Wait>15
Goto>Start
EndIf
GoSub>sWriteIP
Wait>90
Goto>Start

//Checks My Current Internet IP Address By Querying My Router
SRT>sCheckInternetIP
Label>lCheckInternetIP
Let>HTTP_TIMEOUT=10
Let>HTTP_REDIRECTS=1
HTTPRequest>http://192.168.1.1/bsc_sta.htm,,GET,,vHTML,,,,
Let>pattern=[IPAddress]
RegEx>pattern,vHTML,1,matches,num,0
If>num=1
Let>vHTML=%matches_1%
Else
Wait>5
GoTo>lCheckInternetIP
EndIf
END>sCheckInternetIP

//Checks Existing IP Address Stored In Variable, If Blank It Creates One.
//If The Stored IP And The IP From The Router Match It Does Nothing.
//If The Stored IP And The Current IP From The Router Do Not Match,
//It Updates DTDNS, Updates Variable & Notifies Me Via NotifyMyAndroid.
SRT>sWriteIP
Let>REG_INTASSTR=1
If>vRegIP={"vRegIP"}
Let>vRegIP=%vHTML%
EndIF
If>%vHTML%=%vRegIP%
Else
HTTPRequest>http://www.dtdns.com/api/autodns.cfm?id ... ostResults,,,,
Let>vRegIP=%vHTML%
GoSub>sNotifyMyAndroid
EndIf
END>sWriteIP

//Send To NotifyMyAndroid To Push A Message To My Phone About Update.
SRT>sNotifyMyAndroid
Let>POSTDATA=apikey=XXXXXX&application=%strFileName%&event=Hostname Updated&description=%vPostResults%
StringReplace>%POSTDATA%,%SPACE%,%20,POSTDATA
HTTPRequest>http://www.notifymyandroid.com/publicap ... HTMLResult,,,,
END>sNotifyMyAndroid

  View Snippet Page
FIREFIGHTER

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts