DEV Community

Discussion on: Extending an Old-school Programmable Keyboard with AutoHotKey

Collapse
 
ryanmcslomo profile image
Ryan McCallum

I love AHK and I'm a big fan of your wttr.in function! I thought it was super cool and will use in the future. Great read!

I also modified it a lil so it also closes with the same keyboard combo that opened it (toggle):

; https://dev.to/luckierdodge/extending-an-old-school-programmable-keyboard-with-autohotkey-2p1l
; Win + Shift + W - Check weather
#+w::
    windowName := "wttr.in"
    WinHTTP := ComObjCreate("WinHTTP.WinHttpRequest.5.1")
    WinHTTP.Open("GET", "https://wttr.in?FATQ")
    WinHttp.Send()
    response := WinHTTP.ResponseText
    Gui, New,, %windowName%
    Gui, Color, 111111
    Gui, Font, s14 cWhite, Cascadia Mono
    Gui, Add, Text,, % response
    if WinExist(windowName){
        WinClose
    }
    else{
        Gui, Show
        WinSet, AlwaysOnTop, On, %windowName%
    }
Return
Enter fullscreen mode Exit fullscreen mode