AutoHotkey Community

It is currently May 25th, 2012, 10:40 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: July 8th, 2007, 3:18 am 
Offline

Joined: January 27th, 2007, 8:24 pm
Posts: 30
Location: Canada
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 ??


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Yahoo [Bot] and 23 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group