Subject: [aprssig] Homeseer script From: "Wes Johnston" To: "TAPR APRS Special Interest Group" Date: Thu, November 28, 2002 5:46 pm This script uses homeseer's voice text to speech abilities and reads the position of a station out to you relative to your local landmarks. If more than 5 miles from any of your local land marks, it uses a "large cities database". This is using www.aprsworld.net for source data. Note that it also ajusts the time to EST from CST. This is pretty primative, but it works for my wife asking the PC where I am - and doesn't pull and maps from findu. Wes ******************************************************* find.txt sub main() callsign = "kd4rdb-14" callsign = lcase(callsign) hs.speak "getting location of "&replace(ucase(callsign),"-"," dash")&",, Please wait." position = hs.GetURL("db.aprsworld.net","/datamart/switch.php?call="+callsign+"&table=p osition",1,80) position = lcase(position) if instr(1,position,"0 records found")>1 then hs.speak replace(ucase(callsign),"-"," dash") &"not found in server." else position = right(position,len(position)-instr(1,position,"callsign")+1) position = right(position,len(position)-instr(1,position,callsign)+1) timedate=hs.StringItem(position,2,chr(10)) timedate=left(timedate,len(timedate)-3) coursespeed=hs.StringItem(position,3,chr(10)) latlon=hs.StringItem(position,4,chr(10)) callsign=ucase(callsign) callsign=Replace(callsign,"-"," dash ") timedate= DateAdd("h", +1, timedate) daysago=DateDiff("d", date, timedate) timedate=replace(timedate,":00 "," ") if daysago=0 then hs.speak callsign & " was last reported today at "&right(timedate,len(timedate)-instr(1,timedate," ")+1) else if daysago=-1 then hs.Speak callsign &" was last reported yesterday at " & right(timedate,len(timedate)-instr(1,timedate," ")+1) else hs.Speak callsign &" was last reported "& -daysago&" Days ago at "& right(timedate,len(timedate)-instr(1,timedate," ")+1) end if end if if instr(coursespeed,"&")>0 then course=left(coursespeed,instr(1,coursespeed,"&")-1) speed=hs.StringItem(coursespeed,2,"/") else course=0 speed=0 end if bearing=CSng(course) bearing=int((bearing+22.5)/45) Select Case int(bearing) Case 0 course= "north" Case 1 course = "north east" Case 2 course = "east" Case 3 course = "south east" Case 4 course = "south" Case 5 course = "southwest" Case 6 course = "west" Case 7 course = "north west" Case else course = "north" End Select velocity=CSng(speed) if velocity<3 then speed=" and was not moving " else speed=" travelling " + course +" at "& velocity&" miles per hour " end if hs.Speak speed lat=CSng(hs.stringitem(latlon,1," ")) lon=CSng(hs.stringitem(latlon,2," ")) ' ' open the waypoints file and begin to parse. ' line 74 LocationFileName = "location.txt" LocationFile = hs.GetAppPath & "/scripts/" & LocationFileName Set fs = CreateObject("Scripting.FileSystemObject") ' Read the number of different locations (full lines ---> return) in the LocationFIleName Set ThisLocationFile = fs.OpenTextFile(LocationFile, 1, False) counter = 0 distance=99999 locationobject="" Do While Not ThisLocationFile.AtEndOfStream LocationLine = ThisLocationFile.readline lattemp=CSng(hs.stringitem(LocationLine,1,",")) lontemp=CSng(hs.stringitem(LocationLine,2,",")) distancetest=sqr( (lat-lattemp)^2 + ( (lon-lontemp)*cos(lat*.0174) )^2 )*69 if distancetest0 then bearing=" South " if lon_y>0 then bearing=bearing &" East" if lon_y<0 then bearing=bearing &" West" end if loop ThisLocationFile.Close Set ThisLocationFile = Nothing Set FS = Nothing if distance>5 then LocationFileName = "cities.txt" LocationFile = hs.GetAppPath & "/scripts/" & LocationFileName Set fs = CreateObject("Scripting.FileSystemObject") ' Read the number of different locations (full lines ---> return) in the LocationFIleName Set ThisLocationFile = fs.OpenTextFile(LocationFile, 1, False) counter = 0 distance=99999 locationobject="" Do While Not ThisLocationFile.AtEndOfStream LocationLine = ThisLocationFile.readline lattemp=CSng(hs.stringitem(LocationLine,1,",")) lontemp=CSng(hs.stringitem(LocationLine,2,",")) distancetest=sqr( (lat-lattemp)^2 + ( (lon-lontemp)*cos(lat*.0174) )^2 )*69 if distancetest0 then bearing=" South " if lon_y>0 then bearing=bearing &" East" if lon_y<0 then bearing=bearing &" West" end if loop ThisLocationFile.Close Set ThisLocationFile = Nothing Set FS = Nothing end if if distance<.1 then hs.speak " at "&Locationobject else hs.speak int(distance*10)/10 &" Miles "& bearing & " of "&Locationobject end if end if end sub **************************************************************************** *************************** location.txt 33.94981,-080.37228,Sumter Mall 33.95383,-080.37685,The Beacon Movie Theater 33.94467,-80.37047,Wal Mart 33.900067,-080.395175,Sumter High School 33.851214,-080.651366,Paper mill 33.921503,-080.340231,Downtown Library 33.950666,-080.386625,Wesmark Library 33.93487,-080.40055,Home 33.95753,-80.38612,Lowes 34.03147,-80.46320,Hill Crest 34.09465,-80.37806, Woodrow 34.14071,-80.35982, Jim and Sherries House 33.95116,-80.49827, Highway 4 4 1 and 378 **************************************************************************** *************************** cities.txt 33.92040,-80.34148,Sumter South Carolina 33.95756,-80.53469,Stateburg hill South Carolina 33.87732,-80.69235,Eastover South Carolina 34.00093,-81.03469, Columbia South Carolina 34.21807,-80.24940, Bishopville South Carolina 34.18063,-79.77972,Florence South Carolina 33.60235,-80.35135,Summerton South Carolina 33.31899,-80.54826,interstate 26 and interstate 95 33.00528,-80.17737,Summerville South Carolina 32.78553,-79.99451,Charleston South Carolina 32.90697,-80.04108,North Charleston South Carolina 32.98648,-79.99968,Goose Creek South Carolina 33.36236,-79.29583,Georgetown South Carolina 33.69776,-78.89225,Myrtle Beach South Carolina 32.02654,-81.13511,Savannah Georgia 33.45200,-81.99260,Augusta Georgia 35.20129,-80.83756,Charlotte North Carolina 35.25623,-81.16840,Gastonia North Carolina 35.28731,-81.54061,Shelby North Carolina