Sign in to follow this  
Followers 0
JohnOne

_ExitQ (snippet)

5 posts in this topic

#1 ·  Posted (edited)

I often see those little toastie info pop ups coming from my tray, they fade out but if clicked come back.

Like "Oops, I never meant to exit that script."

Never seen one around the forum so made one up.

#include <GUIConstantsEx.au3>

;Set hotkey to exit immediately
HotKeySet('{ESC}', '_ExitQ')

Global Const $TOASTIE_STYLE_UP = BitOR(0x00040000, 0x00000008)
Global $hWnd = GUICreate('Exit?', 300, 200, @DesktopWidth - 320, @DesktopHeight - 240)

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hWnd, "int", 250, "long", $TOASTIE_STYLE_UP)

GUISetState(@SW_SHOWNOACTIVATE, $hWnd)

While 3
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            _ExitQ()
    EndSwitch
WEnd

Func _ExitQ()
    If @HotKeyPressed Then Exit

    ;Fine tune
    Local $iSpeed = -1
    Local $iSleep = 10

    ;Loop down setting transparency as we go
    For $i = 255 To 0 Step $iSpeed
        WinSetTrans($hWnd, '', $i)
        Sleep($iSleep)
        ;If Primary mouse button clicked on gui client area
        ;before finished, reset transparency and do not exit
        If GUIGetMsg() = $GUI_EVENT_PRIMARYDOWN Then
            WinSetTrans($hWnd, '', 255)
            Return
        EndIf
    Next
    Exit
EndFunc   ;==>_ExitQ
Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites



Doesn't Melba's "How to make Toast" UDF do something similar?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Its good, one small comment though

It seems to root itself at the bottom of the screen and covers over my taskbar icons, they are still accessible, maybe it should attach to the top of the taskbar instead?

So you dont get the edge boundry lines showing across the taskbar

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0