#include
#include
#include
; THIS SCRIPT WILL IMMEDIATELY DISPLAY BITCOIN PRICE WHEN PRESSING CTRL + ALT + B
HotKeySet("^!b", "DispPrice")
Func HttpGet($sURL, $sData = "")
Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1")
$oHTTP.Open("GET", $sURL & "?" & $sData, False)
If (@error) Then Return SetError(1, 0, 0)
$oHTTP.Send()
If (@error) Then Return SetError(2, 0, 0)
If ($oHTTP.Status <> 200) Then Return SetError(3, 0, 0)
Return SetError(0, 0, $oHTTP.ResponseText)
EndFunc
Func GetPrice()
Local $thePrice = HttpGet("https://api.cryptowat.ch/markets/coinbase-pro/btcusd/price")
Local $begining = StringInStr($thePrice, '"price":') + 8
Local $ending = StringInStr($thePrice, '},')
Return Int(StringMid($thePrice, $begining, $ending - $begining))
EndFunc
Func DispPrice()
SplashTextOn("Bitcoin Price", GetPrice(), -1, 128, -1, -1, -1, -1, 72, 700)
Local $hWnd = WinGetHandle("Bitcoin Price")
_WinAPI_EnableWindow($hWnd, True)
Local $nStyle = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE)
_WinAPI_SetWindowLong($hWnd, $GWL_STYLE, $nStyle + $WS_SYSMENU)
_WinAPI_SetWindowPos($hWnd, Null, 0, 0, 0, 0, $SWP_NOSIZE + $SWP_NOMOVE + $SWP_FRAMECHANGED)
While WinExists($hWnd)
Sleep(3000)
ControlSetText($hWnd, "", "Static1", GetPrice())
WEnd
SplashOff()
;Exit
EndFunc
While 1
GUIGetMsg()
WEnd