Jump to content

Notify - New version 28 Oct 21


Recommended Posts

  • Moderators

ringerl,

Please try out this Beta version and see if it meets your requirements:

 Notify_Mod.au3

And here is a script to test it:

#include "Notify_Mod.au3"

Opt("TrayAutoPause", 0)

; Press ESC to exit script
HotKeySet("{ESC}", "On_Exit")

; Register message for click event
_Notify_RegMsg()

; Set notification location
_Notify_Locate(0)

_Notify_Set(Default)

_Notify_Show(0, "Short title", "But with a very long message to force truncation until it fits into the maximum width")
ConsoleWrite(@error & @CRLF)
_Notify_Show(0, "Now a very long title to force truncation until it fits into the maximum width", "Short message")
ConsoleWrite(@error & @CRLF)
_Notify_Show(0, "", "No title so the message can span both lines without problem if it is long enough to need it but will be truncated if need be to fit in the maximum width")
ConsoleWrite(@error & @CRLF)
_Notify_Show(0, "", "No_title_so_the_message_can_span_both_lines_without_problem_if_it_is_long_enough_to_need_it_but_will_be_truncated_if_need_be_to_fit_in_the_maximum_width")
ConsoleWrite(@error & @CRLF)

; Now allow for truncation.................................|

;                                                          |
;                                                          V
_Notify_Set(0, Default, Default, Default, False, 250, 250, True)

_Notify_Show(0, "Short title", "But with a very long message to force truncation until it fits into the maximum width")
_Notify_Show(0, "Now a very long title to force truncation until it fits into the maximum width", "Short message")
_Notify_Show(0, "", "No title so the message can span both lines without problem if it is long enough to need it but will be truncated if need be to fit in the maximum width")
_Notify_Show(0, "", "No_title_so_the_message_can_span_both_lines_without_problem_if_it_is_long_enough_to_need_it_but_will_be_truncated_if_need_be_to_fit_in_the_maximum_width")

While 1
    Sleep(10)
WEnd



Func On_Exit()
    Exit
EndFunc

As always, comments from anyone else also welcome.

M23

Edited by Melba23
Re-uploaded file

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 post
Share on other sites
  • Replies 274
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

[NEW VERSION] - 28 Oct 21 Changed: Retracting multiple notifications in close succession could lead to a fatal "array subscript out of bounds" error - added a check to prevent this. New UDF

[NEW VERSION] - 26 Apr 19 Added: _Notify_RetractCheck allows the user to determine the retraction method (title clicked/message clicked/timeout) and content (title/message) of the last retracted

[NEW VERSION] - 4 Jun 17 Added: _Notify_Locate now takes an optional second parameter which, when used in a multiple monitor setup, will force the notifications to appear on a specified monitor r

Posted Images

  • Moderators

Chimaera,

Seeing as that last effort was posted 6 times by the forum (good job I can delete posts!) I am not surprised that it did not work correctly. Try now.

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 post
Share on other sites

Works now

I came in in the middle of this convo but is this a possible alternative to toast?

I ran that code and i got this

Capture.thumb.PNG.03f275d0deae8794ba37f1

Is that correct, i even turned off the top set of notifys and still the same and i ran it both beta and normal

Link to post
Share on other sites

I have reduced this fantastic script to just showing one clickable notification, but now it doesn't exit anymore... just pauses. After several hours, my head is swimming. I just need the script to fully exit, when the user clicks on the notification.

What am I doing wrong?? Any help is MOST appreciated.

Here's the code:

#include "Notify.au3"

Opt("TrayAutoPause", 0)

; Press ESC to exit script
HotKeySet("{ESC}", "On_Exit")

Global $fNot_1_Vis = True, $iBegin = 0

Global $sAutoIt_Path = StringRegExpReplace(@AutoItExe, "(^.*\\)(.*)", "\1")

; Register message for click event
_Notify_RegMsg(0)

; Set notification location
_Notify_Locate(0)

; Show notifications

; Set all values to default
; _Notify_Set(Default)
; _Notify_Show(@AutoItExe, "Not Clickable with EXE icon", "Retracts after 20 secs", 20, 0)

; Set Show time to 250 ms - note fast entry
; _Notify_Set(0, 0xFF0000, 0xFFFF00, "Courier New", False, 250)
; _Notify_Show(0, "Clickable", "Coloured - stays 40 secs if not clicked", 40)

; Change colours and font
; _Notify_Set(4, 0x0000FF, 0xCCFFCC, "Arial")
; _Notify_Show(0, "Clickable", "Only in margin until clicked - click again to retract", 50)

; Reset all values to default
 _Notify_Set(Default)
 _Notify_Show($sAutoIt_Path & "Examples\GUI\Torus.png", "Clickable with PNG", "Reset to default colours")


; Change justification, colours, font, Reset mode to Slide and Show mode to "fade in" 1000ms
; _Notify_Set(6, 0x0000FF, 0xCCCCFF, "Comic MS", True, -1000)
; _Notify_Show(48, "Not Clickable", "With an icon - stays 30 secs", 30, 0)

; Change them all again
; _Notify_Set(0, Default, 0xCCFF00, "Arial", True, Default)
; This one is clickable, but will only remain in the margin until clicked
;$hNot_1 = _Notify_Show(0, "", "No title so the message can span both lines without problem if it is long enough to need it")

; And again
; _Notify_Set(0, Default, 0xFF80FF, "MS Comic Sans", True)
; This one can only be retracted programatically 2 secs after the one above and will fade out, overriding the default setting
;$hNot_2 = _Notify_Show(0, "Programmed Fade", "This will disappear 2 seconds after the 'No Title' one", 0, 0, Default, -1000)

While 1
    Sleep(10)
    ;If Not WinExists($hNot_1) And $fNot_1_Vis = True Then
    ;$iBegin = TimerInit()
        ;$fNot_1_Vis = False
    ;EndIf

    If $iBegin And TimerDiff($iBegin) > 2000 And WinExists($hNot_2) Then
        _Notify_Hide($hNot_2)
        $iBegin = 0
    EndIf

 WEnd



Func On_Exit()
    Exit (0)
EndFunc

Thank you so much!!

Link to post
Share on other sites
  • Moderators

hucom,

Welcome to the AutoIt forums.

If you want the script to end when the notification is clicked, then all you need to do is wait until the notification no longer exists - like this:

#include "Notify.au3"

Opt("TrayAutoPause", 0)

; Press ESC to exit script
HotKeySet("{ESC}", "On_Exit")

Global $fNot_1_Vis = True, $iBegin = 0

Global $sAutoIt_Path = StringRegExpReplace(@AutoItExe, "(^.*\\)(.*)", "\1")

; Register message for click event
_Notify_RegMsg()

; Set notification location
_Notify_Locate(0)

; Reset all values to default
 _Notify_Set(Default)

; Show notification and note handle
 $hNotification = _Notify_Show($sAutoIt_Path & "Examples\GUI\Torus.png", "Clickable with PNG", "Reset to default colours")

While 1
    Sleep(10)

    ; Check to see if notification still exists
    If Not WinExists($hNotification) Then

       ; And exit if not
        On_Exit()
    EndIf

WEnd



Func On_Exit()
    Exit
EndFunc

But I hope you realise that the UDF is designed to remain active as long as its parent script is active so that notifications can be shown when required - that is why the example script that I produced for the UDF (and from which the modified script above was drawn) remains active until a HotKey is pressed.

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 post
Share on other sites
  • Moderators

Chimaera,

Sorry, I missed your post. Yes, that is what is supposed to happen - the titles/texts are truncated to fit if they are too long if the user has set the parameter in _Notify_Set. If not, then the notifications just do not appear and _Notify_Show returns an error.

The UDF is indeed an alternative to Toast - the main difference is that you can show several notifications simultaneously, although by design they are smaller and less flexible in their content.  The user can choose which UDF best suits their requirements - or indeed use both!

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 post
Share on other sites

If you want the script to end when the notification is clicked, then all you need to do is wait until the notification no longer exists - like this:

Wow! You are so fast! I understand your intent and appreciate you input for the way I would like to use the code.

I just tried your modification, now it just disappears right away (doesn't wait for any clicks).

; Check to see if notification still exists
    If Not WinExists($hNotification) Then
       ; And exit if not
        On_Exit()
    EndIf

I'm sorry, I feel like an idiot, but I'm a beginner with autoit...

Thanks again!

Edited by hucom
Link to post
Share on other sites
  • Moderators

hucom,

Did you run the code exactly as I posted it? Because when I run it the notification stays there until clicked - which is what should happen. If you ran something different, please post the code so I can see what is happening.

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 post
Share on other sites

​You are absolutely right, of course. I had pasted a modification from the forums (don't remember which one) of the "Notify" file itself. Now that I reverted that, it works like a charm. 

You are AWESOME. Thank's again!!!

Link to post
Share on other sites
  • Moderators

hucom,

Glad it is working now - and that you like the UDF itself.

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 post
Share on other sites

Glad it is working now - and that you like the UDF itself.

​The last (minor) issue I'm having, is that the .png goes missing when I compile the script (x86 or x64).

"Examples\GUI\Torus.png"

But if you don't have time to reply, I understand :-)

PNG Missing.png

Link to post
Share on other sites
  • Moderators

hucom,

That is because the path used for the png is relative to the executing AutoIt interpreter - when you run the script in SciTE it uses the installed version and so the path is correct; when you compile, the interpreter is in the executable itself and the path is not correct.  If you replace the current computed path with the full path to the image in your installation folder it will show - I have to use "M:\Program\AutoIt3\Examples\GUI\Torus.png".

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 post
Share on other sites
  • Moderators

ringerl,

I see you keep looking at this thread - have you tried the Beta code I posted earlier?

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 post
Share on other sites
  • 2 weeks later...

Chimaera,

Sorry, I missed your post. Yes, that is what is supposed to happen - the titles/texts are truncated to fit if they are too long if the user has set the parameter in _Notify_Set. If not, then the notifications just do not appear and _Notify_Show returns an error.

The UDF is indeed an alternative to Toast - the main difference is that you can show several notifications simultaneously, although by design they are smaller and less flexible in their content.  The user can choose which UDF best suits their requirements - or indeed use both!

M23

​Just got back of hols isnt it supposed to strech so you can read the message then?

Link to post
Share on other sites
  • Moderators

Chimaera,

No:

...that is what is supposed to happen - the titles/texts are truncated to fit if they are too long...

...an alternative to Toast...by design they are smaller and less flexible in their content...

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 post
Share on other sites
  • Moderators

ringer,

Sorry about that, it must have been corrupted by one of the many forum software changes - try now.

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 post
Share on other sites
  • 2 weeks later...
  • Melba23 changed the title to Notify - New version 28 Oct 21

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