Any attempt to Gui.Destroy fails, causes an error.
I tried MyNotification.Hide() but that causes the same error.
I have clearly misunderstood something but reading the docs hasn't helped.
Code: Select all
+CapsLock:: {
SetCapsLockState "On"
MyNotification("CapsLock ON", "10000", "960", "985", "1") ; duration 10s
KeyWait "Esc", "d t10" ; esc skips 10s wait and disables CapsLock immediately
SetCapsLockState "Off"
MyNotification.Destroy() ; error
}
MyNotification(mytext, myduration, xAxis, yAxis, timer) {
MyNotification := Gui()
MyNotification.Opt("+AlwaysOnTop -Caption +ToolWindow") ; +ToolWindow avoids a taskbar button and an alt-tab menu item.
MyNotification.BackColor := "EEEEEE" ; White background
MyNotification.SetFont("s9 w1000", "Arial") ; font size 9, bold
MyNotification.Add("Text", "cBlack Center", mytext) ; black text
MyNotification.Show("x1650 y985 NoActivate") ; NoActivate avoids deactivating the currently active window
WinMove xAxis, yAxis,,, MyNotification
if timer = 1
SetTimer EndMyNotif, myduration * -1
if timer = 0 {
Sleep myduration
EndMyNotif
}
EndMyNotif() {
MyNotification.Destroy()
}
}
Error Box -
Spoiler
Any help solving this would be appreciated.