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 ??