January 31, 200620 yr I saw the following bit of code on a Web site and was wondering if someone would translate it into a FileMaker script? Personally, I would like to use it on a address field that combines all the elements of an address on one line, instead of breaking each element into its own field such as Street, City and Zip. Anyway, I just thought there might be other FileMaker people that would find this very useful. Thanks, Mitch var mapURL = "http://maps.google.com/maps?f=q&hl=en&q="; if (singleResult.address.length > 0) { mapURL += ""; var tmpAddr = singleResult.address.replace(/(s*#.*$)/, ""); mapURL += tmpAddr.replace(/s+/g, "+"); } mapURL += "+"; mapURL += singleResult.city.replace(/s+/g, "+"); mapURL += "+"; mapURL += singleResult.state.replace(/s+/g, "+"); if (singleResult.zip.length > 0) { mapURL += "+"; mapURL += singleResult.zip.replace(/s+/g, "+"); } mapURL += "+"; mapURL += "("; mapURL += singleResult.name.replace(/s+/g, "+"); mapURL += ")"; mapURL += "&btnG=Search&"; // t=h is hybrid, t=m is plain map and t=k is satellite map. Change as desired. mapURL += "t=h";
February 9, 200620 yr I do something similar, but not as sophisticated since I'm not much of a coder. But this works for me:
February 9, 200620 yr Mitch, I'm confused. What are you trying to do? a. Pass address information from FM to Google maps. b. Pull info from Google Maps into FM. c. Just figure out what the code does.
February 21, 200619 yr Author Yes, that sums it up pretty well. In a perfect world, I would like to grab address information from a field in FileMaker, then have it go get the map from Google (or another Map site) and place the map in a container field with the least amount of user interaction as possible. Thank you! Mitch P.S. In my case, it needs to work on both Mac and Windows. I'd prefer not to use any plug-ins, but I have the Troi file plug-in.
February 21, 200619 yr Author Thank you for this script, I haven't tried it yet but I'm going to give it a spin now. Thanks a lot, Mitch
Create an account or sign in to comment