Jump to content

Recommended Posts

Posted (edited)

Bang-a-rang!

OK, I played around and made this function that does what I want.  
I have a dual monitor so set it to appear on my left monitor, this should just work for any setup but don't know.

I made the color of the popup background to match what is on my windows 10 setup.

For others that may want or need or prefer these tray notices to appear a certain way this is my end solution.   

 

#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <ColorConstants.au3>

Global $iconArray[4]  = ["", "16783",  "161", "240" ]

Notice("My Text Message","",0,1)
Notice("","This is a description",0,1)
Notice("Shiny Text Message","Nice Description",0,2)
Notice("","",0,3)
Notice("","",0,0)



Func Notice($message, $description, $timeout = 2, $icon=0)
    Local $popup = GUICreate("",350,60,(@DesktopWidth - 355),(@DesktopHeight - 150),$WS_POPUP+$WS_BORDER) ; title, width, height, left, top, style, exStyle, parent
    GUICtrlSetDefColor(0xFFFFFF)
    GUISetBkColor(0x1F1F1F)

    if($icon > 3) Then $icon = 0
    if($timeout < 1) Then $timeout = 2
    $timeout = $timeout * 1000

    if($icon > 0) Then GUICtrlCreateIcon("shell32.dll", $iconArray[$icon], 10, 7,43,43) ; filename, iconName, left, top, width, height, style, exstyle

    $theMessage = GUICtrlCreateLabel($message,65, 10, 300, 30) ; text, left, top, width, height, style, ex style
    GUICtrlSetFont(-1, 12, 600, 0, "", 2) ; size, weight, attribute ( 2 = italic, 4 = underline, 8 = strike ), fontname, quality
    $theDescription = GUICtrlCreateLabel($description, 65, 32, 300, 30)
    GUICtrlSetFont(-1, 9, 100, 0,"",2) ;
    GUICtrlSetColor(-1, 0xACAEAC)

    GUISetState(@SW_SHOW, $popup)
    Sleep($timeout)
    GUIDelete($popup)
EndFunc

 

Edited by iAmNewbe
Corrected Code
  • Replies 43
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Posted (edited)
Notice("The Message","The Description",0,1)


Text Message, Description, Timeout or Sleep, Icon

Icons are  1 = Notice, 2 = Warning, 3 = Critical   though in Shell32.dll I could not find the same icon used in TrayTip for critical.

Essentially matching the TrayTip features minus the Title at top of the window because I personally don't want it so I removed or never added it in the first place.

Adding the ability to either add or not a description and update it at anytime in code versus only one time with TrayTip at compile time.

Edited by iAmNewbe
Added more info

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
  • Recently Browsing   0 members

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