Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.3: Integrate maporama.com maps in Address Book' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.3: Integrate maporama.com maps in Address Book
Authored by: bluehz on Nov 16, '03 07:58:17PM
This worked better for me:
using terms from application "Address Book"
	on action property
		return "address"
	end action property
	
	on action title for aPerson with anAddress
		return "Map with Maporama"
	end action title
	
	on should enable action for aPerson with anAddress
		return true
	end should enable action
	
	on perform action for aPerson with anAddress
		set estreet to my parseString(street of anAddress)
		set ecity to my parseString(city of anAddress)
		set map_doc to "http://www.maporama.com/share/Map.asp?SESSIONID=&COUNTRYCODE=" ¬
		& country code of anAddress & "&_XgoGCAddress=" & estreet & "&Zip=" & zip of anAddress & ¬
		"&State=" & state of anAddress & "&_XgoGCTownName=" & ecity & "&quality=0&SEARCH_ADDRESS.x=12&SEARCH_ADDRESS.y=14"
		tell application "Safari"
			set browser to make new document
			tell browser
				set URL to map_doc
			end tell
			activate
		end tell
		return true
	end perform action
end using terms from

on parseString(astring)
	set parsed to ""
	set loopCount to 1
	repeat until loopCount > (count characters of astring)
		set char to character loopCount of astring
		if char is in {space} then
			set parsed to parsed & "+"
		else
			set parsed to parsed & char
		end if
		set loopCount to loopCount + 1
	end repeat
	return parsed
end parseString
FYI - ROB - I tried posting this with URL Messaging Protocol (applescript link) to have it load into users script editor with a link. I spent about 2 hours troubleshooting it. Never would display properly in the posting. I researched and found that certain chars were not valid in AS URL's, so I looked for those. Didn't find any. Finally think I narrowed it down to a length issue in the comment.php. Not sure - but I was able to encode small parts of the script and it would work fine. Encode and post teh whole thing and it would not work. I finally figured I could post down to "&_XgoGCTownName" part of the script which ends up being about 1095 chars.

[ Reply to This | # ]
10.3: Integrate maporama.com maps in Address Book
Authored by: aranor on Nov 16, '03 08:22:58PM

D'OH! I originally thought it didn't work because you have a high-ASCII char (opt-return), which won't work for applescript URLs (at least, not in 10.3, according to Apple). However, when I tried pasting the link for my script, the text didn't become a link. Maybe geeklog doesn't like huge URLs like that? Rob - can this be fixed?



[ Reply to This | # ]
10.3: Integrate maporama.com maps in Address Book
Authored by: ars on Nov 16, '03 09:17:47PM

Neither of the two scripts posted above, fill out the country code correctly with foreign addressses in my address book. I have tested this with French, Australian and Dutch addresses. I could see from the URL in Safari's address bar that the country code was US instead of FR or AU for the first two. When I manually changed the country code the map shows up correctly, so that the rest of the address is read correctly. When I tried it with the Dutch address it listed "missing" as country code and again when changing it to NL it worked. Any hint why this might be happening?



[ Reply to This | # ]
10.3: Integrate maporama.com maps in Address Book
Authored by: ars on Nov 16, '03 09:42:44PM

I found what the problem was: I had imported many of my addresses via Isync from my palmos pda, This import does not automatically format foreign addresses in the format used by the other country (the palm address book does not support these other formats). When I changed (via the address book's help) the addresses to the right format it works.



[ Reply to This | # ]