+parkrrrr Posted December 18, 2002 Share Posted December 18, 2002 Here's a little something for those of you who are somewhat geeky and can write VBScript by example but get bogged down in the morass of ActiveX objects out there. It doesn't do anything useful, but the general idea can certainly be adapted to better projects. As it is now, if you save this into a file called "gpx.vbs" and run "cscript gpx.vbs" from a command prompt, you'll get a tab-separated list of GCID, lat, lon, and name (after you change the 4548.gpx to match your own GPX file.) I'm sure you creative types can come up with something better to do with this... Set XMLDoc = CreateObject( "Msxml2.DOMDocument" )XMLDoc.Load "4548.gpx" Set GPX = XMLDoc.selectsinglenode("gpx")for each Wpt in GPX.selectnodes("wpt") lat = Wpt.attributes.getNamedItem("lat").Value lon = Wpt.attributes.getNamedItem("lon").Value set cache = wpt.selectsinglenode("Groundspeak:cache") name = cache.selectsinglenode("Groundspeak:name").text GCID = "GC"+hex(cache.attributes.getnameditem("id").value) wscript.echo GCID + chr(9) + lat + chr(9) + lon + chr(9) + namenext [This message was edited by Warm Fuzzies - Fuzzy on December 18, 2002 at 07:20 AM.] Link to comment
+parkrrrr Posted December 18, 2002 Author Share Posted December 18, 2002 This one might even be a little useful. Again, you'll have to replace the "4548.gpx" with your own GPX file, and you'll probably want to change the header, too. This one, by the way, is HTML. Call it 4548.html, load it in IE, and print the results. Unfortunately, this is not compatible with Plucker or AvantGo. Y'all might have to wait for that. <script language="vbscript">sub ReadGPX Set XMLDoc = CreateObject( "Msxml2.DOMDocument" ) XMLDoc.Load "4548.gpx" Set GPX = XMLDoc.selectsinglenode("gpx") for each Wpt in GPX.selectnodes("wpt") lat = Wpt.attributes.getNamedItem("lat").Value lon = Wpt.attributes.getNamedItem("lon").Value set cache = wpt.selectsinglenode("Groundspeak:cache") name = cache.selectsinglenode("Groundspeak:name").text GCID = "GC"+hex(cache.attributes.getnameditem("id").value) ID = cache.attributes.getnameditem("id").text T = "<h2 id="+GCID+"><a href=http://www.geocaching.com/seek/cache_details.aspx?ID=" T = T + ID + ">"+ GCID + "</a> " + name + "</h2><p>" T = T + cache.selectsinglenode("Groundspeak:short_description").text T = T + "</p><p>" T = T + cache.selectsinglenode("Groundspeak:long_description").text T = T + "</p><a href=#contents>contents</a>" CE = "<a href=#"+GCID+">"+GCID+" "+name+"</a><br>" set tc = document.body.all("contents") tc.innerhtml = tc.innerhtml + CE set xs = document.body.all("xmlstuff") xs.innerhtml = xs.innerhtml + T nextend sub</script><body onload="ReadGPX()"><h1> Fuzzy's Nearby Caches </h1><div id="contents"></div><div id="xmlstuff"></div></body> [This message was edited by Warm Fuzzies - Fuzzy on December 18, 2002 at 09:34 AM.] Link to comment
+Markwell Posted December 18, 2002 Share Posted December 18, 2002 I tried a little, but wouldn't it also be simple to have the header line for each cache also link to the cache page? Add before the name and after? My meager attempt crashed the file. Markwell Chicago Geocaching Link to comment
+parkrrrr Posted December 18, 2002 Author Share Posted December 18, 2002 quote:Originally posted by Markwell:I tried a little, but wouldn't it also be simple to have the header line for each cache also link to the cache page? Good idea. I've updated the original post to include that functionality. [edit: except I forgot the "target=new" part. I trust you can add that yourself; I just forgot it.] [This message was edited by Warm Fuzzies - Fuzzy on December 18, 2002 at 10:27 AM.] Link to comment
teamwsmf Posted December 18, 2002 Share Posted December 18, 2002 quote:Originally posted by Warm Fuzzies - Fuzzy:This one might even be a little useful. Spot On Warm Fuzzies!!!! This should go a long way in letting folks use the geocaching data as they see fit, seeing as how it was entered by the people to begin with- With this bit of code folks can easily host up thier own local bit of geocaching info without "distrubing" the forces of gc.com. If I had time Id putz around wiht a php version of the same just so theres another way to do it. 100 thanks for your work on this bit of code. -teamwsmf ---------------------------- TeamWSMF@wsmf.org Link to comment
+parkrrrr Posted December 18, 2002 Author Share Posted December 18, 2002 quote:Originally posted by TeamWSMF:With this bit of code folks can easily host up thier own local bit of geocaching info without "distrubing" the forces of gc.com. Actually, not quite. The script changes the appearance of the page in the browser, but if you save the page you get the original source (i.e. what you see above) rather than the modified source. This is a "feature" of Internet Explorer, apparently. Thus, you can view and print the pretty version of the data, but you can't put it on your website. Yet. Link to comment
teamwsmf Posted December 18, 2002 Share Posted December 18, 2002 quote:Yet. Yet being the operative word. Im sure somethig will come along inthe next 12 hours or so- An XLS style sheet would work nicely. ---------------------------- TeamWSMF@wsmf.org [This message was edited by TeamWSMF on December 18, 2002 at 10:53 PM.] Link to comment
Recommended Posts