Created
April 22, 2021 21:16
-
-
Save JoeGlines/f897f440a19f56c4393e5ef69df33256 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;******************************************************* | |
; Want a clear path for learning AutoHotkey; Take a look at our AutoHotkey Udemy courses. They're structured in a way to make learning AHK EASY | |
; Right now you can get a coupon code here: https://the-Automator.com/Learn | |
;******************************************************* | |
;~ https://developers.google.com/maps/documentation/directions/ | |
IniRead, API_Key,Auth.ini,API,Key ;read current token | |
queryString:=QueryString_Builder({"origin":"75 9th Ave New York, NY","destination":"MetLife Stadium 1 MetLife Stadium Dr East Rutherford, NJ 07073","key":API_Key}) | |
Endpoint:="https://maps.googleapis.com/maps/api/directions/" . "xml" ;xml or json | |
;***********API call******************* | |
HTTP := ComObjCreate("WinHttp.WinHttpRequest.5.1") | |
HTTP.Open("GET", Endpoint . queryString) ; "GET" "POST" ; be sure to uppercase | |
HTTP.SetRequestHeader("Content-Type","application/x-www-form-urlencoded") | |
HTTP.Send() | |
Response:=HTTP.ResponseText | |
SciTE_Output(Response) | |
;~ SciTE_Output(sXML_Pretty(Response," ")) ;Text,Clear=1,LineBreak=1,Exit=0 | |
;***********query string builder******************* | |
QueryString_Builder(kvp){ | |
for key, value in kvp | |
queryString.=((A_Index="1")?(url "?"):("&")) key "=" value | |
return queryString | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment