'http://www.geonames.org/export/geonames-search.html Option Explicit Dim app, mediaItems, mediaItem Dim L_title_text, L_message1_text L_title_text = "Microsoft Expression Media" L_message1_text = "Please launch Microsoft Expression Media." Main() Sub Main() Set app = CreateObject("iView.Application") ' Set app = CreateObject("ExpressionMedia.Application") Set mediaItems = app.ActiveCatalog.MediaItems For Each mediaItem In mediaItems if( mediaItem.Selected ) Then if( mediaItem.DeviceInfo.Longitude = "" ) Then Else GPS mediaItem End If End If Next End Sub Function Degrees(value) Dim NESW Dim Degree Dim Minutes, Seconds NESW = Mid(value,1,1) Degree = Mid(value,3,3) + 0 Minutes = Mid(value,8,2) / 60 Seconds = Mid(value,12,4) / 60 / 60 Dim Sign Sign = 1 If( NESW = "W" ) Then Sign = -1 End If Degrees = Sign * (Degree + Minutes + Seconds) End Function Sub GPS(mediaItem) Dim longString , latString longString = mediaItem.DeviceInfo.Longitude latString = mediaItem.DeviceInfo.Latitude Dim longitude, latitude longitude = Degrees( longString ) latitude = Degrees( latString ) Dim xmlhttp, xmldom Dim cityNode, countryNode, isoCodeNode , stateNode, locationNode dim nbySuffix nbySuffix = "&style=full" Set xmlhttp = CreateObject("Microsoft.XMLHTTP") '-------------------->findNearbyPlaceName xmlhttp.open "GET", "http://ws.geonames.org/findNearbyPlaceName?lat="+CStr(latitude)+"&lng="+CStr(longitude), False Set xmldom = CreateObject("Microsoft.XMLDOM") xmlhttp.send xmldom xmldom.loadXML(xmlhttp.responseText) 'uncomment this for debugging - copy contents to browser URL 'inputbox "findNearbyPlaceName", , "http://ws.geonames.org/findNearbyPlaceName?lat="+CStr(latitude)+"&lng="+CStr(longitude) & nbySuffix Set cityNode = xmldom.selectSingleNode("geonames/geoname/name") '-------------------->findNearby xmlhttp.open "GET", "http://ws.geonames.org/findNearby?lat="+CStr(latitude)+"&lng="+CStr(longitude) & nbySuffix , False Set xmldom = CreateObject("Microsoft.XMLDOM") xmlhttp.send xmldom xmldom.loadXML(xmlhttp.responseText) 'uncomment this for debugging - copy contents to browser URL 'inputbox "findNearby", , "http://ws.geonames.org/findNearby?lat="+CStr(latitude)+"&lng="+CStr(longitude) & nbySuffix Set countryNode = xmldom.selectSingleNode("geonames/geoname/countryName") Set isoCodeNode = xmldom.selectSingleNode("geonames/geoname/countryCode") If isoCodeNode.text = "IT" or isoCodeNode.text = "US" then Set stateNode = xmldom.selectSingleNode("geonames/geoname/adminName1") '----------- Italian treatment Set locationNode = xmldom.selectSingleNode("geonames/geoname/name") elseif isoCodeNode.text = "GB" then Set stateNode = xmldom.selectSingleNode("geonames/geoname/adminName2") '----------- UK treatment Set locationNode = xmldom.selectSingleNode("geonames/geoname/name") elseif isoCodeNode.text = "CH" then Set stateNode = xmldom.selectSingleNode("geonames/geoname/adminName1") '----------- UK treatment Set locationNode = cityNode end if '------------------- now update the catalogue mediaItem.Annotations.Country = countryNode.text mediaItem.Annotations.State = stateNode.text mediaItem.Annotations.City = cityNode.text mediaItem.Annotations.Location = locationNode.text mediaItem.Annotations.CountryCode = isoCodeNode.text End Sub