AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Basic (googlemaps) driving directions

 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Dave72



Joined: 27 Jan 2007
Posts: 30
Location: Canada

PostPosted: Sun Jul 08, 2007 2:18 am    Post subject: Basic (googlemaps) driving directions Reply with quote

Ive been making modules for use with my SMS(cell)<->SMTP(pc) application.. got one working today for retrieving basic driving directions to/from addresses using googlemaps.

Ill spare you the full code.. (some of it is in the Ask for Help section), but if you pass the var Message in the format of 100 Main St Anytown ND,555 Brown Ave Somewhere MN to the script (note the comma divider between the to and from addresses) then you should get a reasonable directions set as %html% and in the file result.txt (in my full code further on, I divide up the %html% into 100 char chunks for SMS sending via Blat.)

Maybe someone can find this useful to play with..



Code:
StringSplit, Location, Message,`,
   FileDelete, gmap.html
   FileDelete, result.txt
   AddrFrom := Location1
   AddrTo := Location2
   StringSend_A := "http://maps.google.com/maps?saddr="
   StringSend_C := "&daddr="
   StringSend_E := "&hl=en&output=html" ;html js
   URLDownloadToFile, %StringSend_A%%AddrFrom%%StringSend_C%%AddrTo%%StringSend_E%, gmap.html
   FileRead, html, gmap.html
   StringGetPos, startblock, html, Drive:
   StringTrimLeft, html, html, startblock
   StringGetPos, endblock, html, afterRoute
   StringLeft, html, html, endblock
   html:= RegExReplace(html, "<.+?>")
   StringReplace, html, html, ,,All
   StringReplace, html, html,–,,All
   StringTrimRight, html, html, 45
   FileAppend, %html%, result.txt   


Some code wont post.. in the 2 StringReplace lines, after the html,html, it should read &_#_160;,,All (remove the underscores) and the other one as &_#_8211;,,All (remove the underscores)

ps: good grief what a mess of edits for that post.. lol.. is there some reason that & code wont post to the board ??
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group