Jump to content

How to make Toast - New version 2 Aug 18


Melba23
 Share

Recommended Posts

Melba23,

Had occasion to make use of your very excellent Toast UDF in a recent project.

Don't know if's been addressed in the 14 pages of posts so far, but I required the ability to use specific icons from the compiled exe and so I made a slight modification beginning at line 279 of your source where you check to see if an exe or ico file was passed to the function as the $vIcon parameter.

;Replace lines 279 to 286 in 01 April 17 verion of TOAST.AU3
        ;Added by ResNullius to accomodate choice of multiple icons in exe, dll
        If StringInStr($vIcon, "|") Then
            $iIcon_Style = StringRegExpReplace($vIcon, "(.*)\|", "")
            $sDLL = StringRegExpReplace($vIcon, "\|.*$", "")
        Else
        ;End Added by ResNullius to accomodate numbered icons in exe
            Switch StringLower(StringRight($vIcon, 3))
                Case "exe", "ico"
                    $sDLL = $vIcon
                    $iIcon_Style = 0
                Case "bmp", "jpg", "gif", "png"
                    $sImg = $vIcon
            EndSwitch
        EndIf
    EndIf

I call it from the compiled script like this:

_Toast_Show(@AutoItExe & "|203", "My Program", "My Message",3)
;or
_ToastShow("C:\CoolScripts\MyCoolScript.exe|201","My Cool Script", "My Cool Message",3)

The pipe symbol "|" is used to separate the file name from the icon's resource/ordinal name.

Not tested extensively, but worked a treat for my purposes.

Thanks again for all you do for this community!


 

Link to comment
Share on other sites

  • 4 months later...

Thank you very much for this. Found it more useful than my normal notification script (which launches a centered interface and must be rewritten for every small change).

Spoiler

 

"If a vegetarian eats vegetables,What the heck does a humanitarian eat?"

"I hear voices in my head, but I ignore them and continue on killing."

"You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring."

An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist.

 

 
Link to comment
Share on other sites

  • 3 months later...
  • Moderators

Cotino,

Take a look at my Notify UDF - that enables you to have multiple notifications at the same time.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Cotino,

Glad I could help.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

[NEW VERSION] - 2 Aug 18

Added: When specifying the icon to use, if the $vIcon parameter is set to the name of an ico or exe file, the main icon within will be displayed, but if a trailing "|" followed by the icon index is added to the name, that icon from within the file is used

New UDF and example in the first post.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • 2 years later...

Setting up a toast notification using Task Scheduler on Kiosk computers but appear to be getting some odd behaviour, a couple of users have reported the the toast is appearing in the top left hand corner of the screen opposed to above the system tray (bottom right).  It doesn't always occur and unfortunately I've been unable to replicate the issue, I though it might be related to the script starting before the system tray appears but would have expected an error with GuiCreate in _Toast_Show() function.

Users profiles are removed on log off so default settings should always be applicable, i.e. system tray is always set to the bottom right of the screen.  Will look at creating default dimensions if $aTray_Pos = WinGetPos(...) returns an error.

Has anyone else seen this behavior?

Link to comment
Share on other sites

  • 1 year later...

 I'm getting crashes when I have my Windows 10's Taskbar set to automatically hide.

Error:

"H:\include\Toast.au3" (361) : ==> Subscript used on non-accessible variable.:
$hToast_Handle = GUICreate("", $iToast_Width, $iToast_Height, $aToast_Data[0], $aToast_Data[1], 0x80880000, BitOR(0x00000080, 0x00000008))
$hToast_Handle = GUICreate("", $iToast_Width, $iToast_Height, $aToast_Data^ ERROR

Most people would probably never find this bug, but I wrote an alarm program that repeatedly shows and hides a Toast, so I encounter the bug pretty frequently.

To reproduce:

Right-click the Taskbar and click "Taskbar Settings".

Turn on "Automatically hide the Taskbar in Desktop mode".

Then run this script and repeatedly tap the Windows key fast (to show/hide the Taskbar) until you get a crash:

#include <Toast.au3>

_Toast_Set(-1, -1, -1, -1, -1, 14, "Arial", 100, 100)

While 1

    _Toast_Show(@ScriptFullPath, @ScriptName, 'foo')
WEnd

  

Edited by lee321987
Link to comment
Share on other sites

  • Moderators

lee321987,

Using a Toast to "flash" like that is completely outside the normal use parameters of the UDF. And needing to "repeatedly tap the Windows key fast" to induce the error is also well outside any normal usage that can be expected.

As a result I am not going to investigate your error further. For your interest it is caused by the UDF being unable to correctly calculate the required position of the Toast - and that is hardly surprising given that the taskbar would be constantly appearing and reappearing while the Toast was extending and retracting extremely rapidly.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • 2 years later...
On 2/8/2018 at 10:03, Melba23 said:

[NUEVA VERSIÓN] - 2 de agosto de 2018

Agregado : Al especificar el ícono a usar, si el parámetro $vIcon se establece en el nombre de un archivo ico o exe, se mostrará el ícono principal dentro del archivo, pero si se agrega un "|" final seguido del índice del ícono al nombre, se usa ese ícono dentro del archivo.

Nueva UDF y ejemplo en el primer post.

M23

You could give an example using "|" please

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...