Applescript to switch time machine based on network.

I started writing a applescript that can change your time machine location based on the MAC address of the currently networked router.
As of now, it only works with a locally attached hard drives. I was hoping I could reach out to you guys, and have improvements made. Long term, I think a Service is the best way to implement this, but the code needs to be good first, so here we go!:

getmyip() is used to currently, easier to test, in final result, getroutermac() should be called


property knownMACID : {}
property knownTMVolumesPath : {}
property vers : "0.2"


(*


.2:
Added faster routine, for geting router MAC Adddress, from @seesolve on twitter
.1:
First Working Demo of script, only shows you whats going to happen, does not actually do backup.


*)
on getgetroutermac()
	return (do shell script "arp `netstat -r -f inet | awk '/^default/ {print $2}'` | cut -f4 -d\" \"")
end getgetroutermac

on getmyip()
	return (IPv4 address of (system info))
end getmyip

on run {}
	set ISON_knownMACID to 0
	repeat with i from 1 to length of knownMACID
		if item i of knownMACID = getmyip() then
			set ISON_knownMACID to i
			exit repeat
		end if
	end repeat
	
	if ISON_knownMACID ≠ 0 then
		display dialog getmyip() & "  " & item (ISON_knownMACID) of knownTMVolumesPath
		
		display dialog "tmutil setdestination \"" & item (ISON_knownMACID) of knownTMVolumesPath & "\""
		--do shell script "tmutil setdestination \"" & item (ISON_knownMACID) of knownTMVolumesPath & "\"" with administrator privileges
		delay 2
		display dialog "this is where we verify to make sure time machine is on"
		--do shell script "tmutil enable" with administrator privileges
		delay 3
		display dialog "And this is where we start a backup"
		--do shell script "tmutil startbackup" with administrator privileges
		
	else
		set temp1 to getmyip()
		set temp2 to TMBackupVolume()
		if temp2 does not contain "ERR:" then
			display dialog "This location is new, adding the following info: 
" & temp1 & "
" & temp2
			set end of knownMACID to temp1
			set end of knownTMVolumesPath to temp2
		else
			display dialog temp2 as string
		end if
	end if
end run
on TMBackupVolume()
	try
		set ON_ERROR to false
		set tmutilresponse to (do shell script "tmutil latestbackup")
	on error errorreturned
		set ON_ERROR to true
		display dialog errorreturned
	end try
	if ON_ERROR = false then
		return (item 1 of stringtolist(tmutilresponse, "Backups.backupdb"))
	else
		return ("ERR: " & errorreturned)
	end if
end TMBackupVolume

on stringtolist(theString, delim)
	set oldelim to AppleScript's text item delimiters
	set AppleScript's text item delimiters to delim
	set dlist to (every text item of theString)
	set AppleScript's text item delimiters to oldelim
	return dlist
end stringtolist
on ListToString(theList, delim)
	set oldelim to AppleScript's text item delimiters
	set AppleScript's text item delimiters to delim
	set alist to theList as string
	set AppleScript's text item delimiters to oldelim
	return alist
end ListToString