         id := a%A_Index%
         WinGetClass, cls, ahk_id %id%
         ; Skip the "GDI+" window
-        If(RegExMatch(cls, "^GDI") = 0) {
+        If(RegExMatch(cls, "^GDI") == 0) {
             return id
         }
     }

    MsgNum := DllCall("RegisterWindowMessage", Str, "VIRTUALDESKTOPGRIDSWITCHER_COMMAND")

    exeName := "VirtualDesktopGridSwitcher.exe"

    ; Launch VirtualDesktopGridManager if it's not already running.
    DetectHiddenWindows, On
    If !WinExist("ahk_exe " . exeName) {
        Run "../VirtualDesktopGridSwitcher.exe"
    }


}

; Called when VirtualDesktopGridSwitcher sends us a message
ReceiveMessage(command, value, msg, hwnd) {
    ; All variables are global unless declared to be local
    global
    local num
    if (command == SWITCHED_DESKTOP) {
        num := value + 1
        ShowOverlay("Desktop " + num, desktopName[value], "../Icons/" . num . ".ico")
    } else {
        MsgBox, % command, % value
    }
}

