Google Latitude and Applescript
I am trying to get a peice of code working that someone gave out. It's basic point it to return your location via google's latitude service. It is wrote in the form of a handler and the handler seems like it would work. The problem is that in the top of the script file, there is a variable that seems to be set to load the user name and password of google latitude. When i ran the script as a whole it merely said it could not find the file that contained the username and password.
set library to (load script ((“/Library/Application Support/Jarvis/Library.scpt”) as POSIX file))
property myGoogleLatID : (do shell script "defaults read /Library/Preferences/Jarvis googleLatID")
on getGPSLocation()
try
set rawdata to do shell script "curl 'http://www.google.com/latitude/apps/badge/api?user=" & myGoogleLatID & "&type=atom'"
set mylocation to replaceText(space, ",", (first item of xml_parser(rawdata, "georss:point")))
set myLongitude to first word of mylocation
set myLatitude to last word of mylocation
set rawdata to do shell script "curl 'http://maps.google.com/maps/geo?output=xml&key=abcdefg&q=" & mylocation & "'"
set myZipcode to first item of xml_parser(rawdata, "PostalCodeNumber")
set myCountry to first item of xml_parser(rawdata, "CountryName")
set myState to first item of xml_parser(rawdata, "AdministrativeAreaName")
set myTown to first item of xml_parser(rawdata, "LocalityName")
set myStreet to first item of xml_parser(rawdata, "ThoroughfareName")
set mylocation to {street:myStreet, city:myTown, state:myState, zipcode:myZipcode, country:myCountry, longitude:myLongitude, latitude:myLatitude}
on error themessage
set mylocation to {street:"n/a", city:"n/a", state:"n/a", zipcode:"n/a", country:"n/a", longitude:"n/a", latitude:"n/a"}
return themessage
end try
return mylocation
end getGPSLocation
within my library file, i also have the handlers for replaceText() and the xml_parser(). I really just need to know how to create a file, the googleLatID, that this handler will be able to read the username and password to. There are many of these types of files thta would basically load my user name and password for various different accounts and website so that my handlers can work with those website.
Mac OS X (10.6.8)