Jump to content

_ExitQ (snippet)


JohnOne
 Share

Recommended Posts

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.

Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...