Bartimus was looking for a Toaster-Style popup window, so I made this with help from aCkRiTe, BoBo, and Engunneer:
#SingleInstance Force #NoTrayIcon #NoEnv DetectHiddenWindows, On SysGet, Workspace, MonitorWorkArea Gui, -Caption +ToolWindow +LastFound +AlwaysOnTop +Border Gui, Color, White Gui, Font, s14 cRed Gui, Add, Text, gFade, Here is your toaster popup!`nClick me to make me go away! Gui, Show, Hide GUI_ID := WinExist() WinGetPos, GUIX, GUIY, GUIWidth, GUIHeight, ahk_id %GUI_ID% NewX := WorkSpaceRight-GUIWidth-5 NewY := WorkspaceBottom-GUIHeight-5 Gui, Show, Hide x%NewX% y%NewY% DllCall("AnimateWindow","UInt",GUI_ID,"Int",500,"UInt","0x00040008") ; TOAST! Return Fade: DllCall("AnimateWindow","UInt",GUI_ID,"Int",1000,"UInt","0x90000") ; Fade out when clicked ExitApp
Since Bartimus wanted a built in function, I decided it was a good time to learn how to do that. Here's the code in function form (do I need to use that arbitrary Gui # to avoid interference with any other GUIs??) -
;Syntax: ToasterPopup(["Message"],["Font Color"],["Font Size"],["Background Color"],[Lifetime in MS (0 to persist until clicked)] ;Example: ToasterPopup("This is a Toaster Popup...", "Blue", "14", "White", 0) Return ToasterPopup(TP_Message, TP_FontColor, TP_FontSize, TP_BGColor, TP_Lifespan) { DetectHiddenWindows, On SysGet, Workspace, MonitorWorkArea Gui, 89:-Caption +ToolWindow +LastFound +AlwaysOnTop +Border Gui, 89:Color, %TP_BGColor% Gui, 89:Font, s%TP_FontSize% c%TP_FontColor% Gui, 89:Add, Text, gTP_Fade, %TP_Message% Gui, 89:Show, Hide Global GUI_ID ;Is this the proper way to use Global? I need it for TP_Fade... GUI_ID := WinExist() WinGetPos, GUIX, GUIY, GUIWidth, GUIHeight, ahk_id %GUI_ID% NewX := WorkSpaceRight-GUIWidth-5 NewY := WorkspaceBottom-GUIHeight-5 Gui, 89:Show, Hide x%NewX% y%NewY% DllCall("AnimateWindow","UInt",GUI_ID,"Int",500,"UInt","0x00040008") ; TOAST! If (TP_Lifespan=0) Return Else { Sleep, %TP_Lifespan% GoSub, Fade Return } TP_Fade: DllCall("AnimateWindow","UInt",GUI_ID,"Int",1000,"UInt","0x90000") ; Fade out when clicked Return }