*** create 2 parameters and pass the following:
***cStartAddress = "<<start Address>>" &&&
***cDestAddress = "End Address>>"
google_directions(cStartAddress, cDestAddress)
Procedure google_directions
Lparameters tcStartAddress, tcDestAddress
Local CRLF, cUrl, oHTTP, nStart, nEnd, cResult, cTag, lTag, oIE
Store Chr(13)+Chr(10) To CRLF
Set Library To Home()+"Foxtools.fll" Additive
tcStartAddress=Chrtran(Alltrim(reduce(tcStartAddress)),Chr(32),"+")
tcDestAddress =Chrtran(Alltrim(reduce(tcDestAddress )),Chr(32),"+")
cUrl = "[URL unfurl="true"]http://www.google.com/maps?f=d&hl=en&saddr="[/URL] + tcStartAddress + "&daddr=" + tcDestAddress
oHTTP = Createobject([MSXML2.XMLHTTP])
oHTTP.Open("GET", cUrl, .F.)
oHTTP.Send
cResult=(oHTTP.ResponseText)
nStart = Atc("<table class=\042dirsegment\042>", cResult, 1)
cResult = Substr(cResult, nStart , Len(cResult)- nStart)
nEnd = Atc("afterRoute\", cResult, 1)
cResult = Strtran(Left(cResult, nEnd)+">", "<br>", " ")
cResult = Strtran(cResult," ", Space(3))
&&remove Html Tags
lTags = .T.
Do While lTags
nStart = Atc("<", cResult, 1)
nEnd = Atc(">", cResult, 1)
cTag = Substr(cResult, nStart, 1 + nEnd - nStart)
cResult = Strtran(cResult, cTag, Iif(Lower(cTag)=="</td>", CRLF,""))
If Occurs("<",cResult)>0 And Occurs(">",cResult)>0
lTags = .T.
Else
lTags = .F.
Endif
Enddo
If Len(cResult)=1 &&troubleshoot
oIE = Createobject("InternetExplorer.Application")
oIE.Navigate2(cUrl)
oIE.Visible=.T.
*Messagebox("See what went wrong.", 0, "", 15000)
*oIE.Quit
Else
&& sucess
Strtofile(cResult,"cut.txt")
Modify File cut.txt Nowait
Endif
Endproc