Jump to content

Notify - New version 17 Mar 22


Melba23
 Share

Recommended Posts

  • 2 weeks later...

melba - this is great. I already use your toast udf.

So.... I know I can add a progress bar using the toast udf (already done it - thanks!)...

but I think from an aesthetic standpoint, I have a need (desire) to use a notification instead, and put a small progress bar inside of it.

Any thoughts? Good idea, bad idea?

Link to comment
Share on other sites

  • Moderators

z0iid,

Of course you can add controls - you do something like this: :)

#include "Notify_Mod.au3"
#include <ProgressConstants.au3>

HotKeySet("{ESC}", "On_Exit")

_Notify_RegMsg()

_Notify_Locate(0)

_Notify_Show(0, "Progress", "", 0, 1)

GUICtrlCreateProgress(20, 25, 100, 10, $PBS_MARQUEE)
GUICtrlSendMsg(-1, $PBM_SETMARQUEE, True, 50)

While 1
    Sleep(10)
WEnd

Func On_Exit()
    Exit
EndFunc

Just remember to use GUISwitch if you want to create controls on an existing GUI later in the script. ;)

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

z0iid, Of course you can add controls - you do something like this: :)

#include "Notify_Mod.au3" #include  HotKeySet("{ESC}", "On_Exit") _Notify_RegMsg() _Notify_Locate(0) _Notify_Show(0, "Progress", "", 0, 1) GUICtrlCreateProgress(20, 25, 100, 10, $PBS_MARQUEE) GUICtrlSendMsg(-1, $PBM_SETMARQUEE, True, 50) While 1 Sleep(10) WEnd Func On_Exit() Exit EndFunc
Just remember to use GUISwitch if you want to create controls on an existing GUI later in the script. ;) M23
Thank you - that is what I'm looking for.

Are these notification boxes resizable, or static sized? I can't seem to stuff more information, ie, 2 lines of info, or 1 line of info + progress bar.

Link to comment
Share on other sites

  • Moderators

z0iid,

The notifications are 40 pixels high and between 150 and 300 pixels wide depending on the text you put in them. They were designed for displaying quick messages and I have no plans to make them bigger or user-sizable. :)

If you want something that can display much more data then take a look at my Toast UDF which pops up a GUI fitted to the contents from the systray. Or perhaps the ExtMsgBox UDF which shows a similarly sized GUI anywhere on screen with user-definable buttons. Plenty of options to choose from! ;)

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

z0iid, The notifications are 40 pixels high and between 150 and 300 pixels wide depending on the text you put in them. They were designed for displaying quick messages and I have no plans to make them bigger or user-sizable. :) If you want something that can display much more data then take a look at my Toast UDF which pops up a GUI fitted to the contents from the systray. Or perhaps the ExtMsgBox UDF which shows a similarly sized GUI anywhere on screen with user-definable buttons. Plenty of options to choose from! ;) M23

yup - i love the toast udf, and already use it - i just liked the notify mechanism better for the specific use case. i may try to make the toast work in this case.

thanks for all your work - your stuff is great.

Link to comment
Share on other sites

I have been making some further modifications to my keyboard, see link in post Nº22. The notification message says the the program is already running (you saw that already). When clicked, not only must the notification message disappear but the script also needs to exit. To acheive this; in the function _Notify_WM_MOUSEACTIVATE I have replaced the Return Value with Exit:

Replaced

Return "GUI_RUNDEFMSG"

Now the script exits immediately after clicking the notification, and since I only allow two instances of the script to be running simultaneously (one to notify the user of the other running instance) it is no longer necessary to wait for the (sleep) process to time out before the notification can be displayed again. Everything seems fine, and I thought I should mention this since it might be useful to someone else. I also wanted to check if I was going about this the right way. Are there any unforseen issues I should know about? Thanks!

Edited by czardas
Link to comment
Share on other sites

  • Moderators

czardas,

I cannot see why that would cause any problems. If you do not even want to wait for the Notification to retract before exiting, you could replace the _Notify_Delete($i) line in that function with Exit. :)

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

Ah okay, I'll do that. I didn't really want to modify your code, but I'm happy with the changes. Thanks for the quick responce.

Edit

Ha! I like the graceful way the notification slides off the screen, so I kept _Notify_Delete($i) and replaced the next two lines instead. :)

Edited by czardas
Link to comment
Share on other sites

I know its a little off topic, however, in post #24 you show the progress bar with $PBS_MARQUEE and then set it its value. I looked at the ProgressConstants.au3 and saw the info, but I couldn't find this in the help file under Progress Bar Styles or under extended styles. Is there any other way I could check to see all the options available for this function?

Thanks

Chad

Link to comment
Share on other sites

  • Moderators

Chad2,

We are ahead of you - $PBS_MARQUEE appears in the Progress Bar Styles in the new Beta Help file. :)

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

another question Melba.... (just tell me to go away if i'm too bothersome)

I'm using the $PBS_MARQUEE with notify... no problem there, works great. But I'm creating the notification before my while loop (in an if loop) - not clickable, and doesn't time out. BUT...i want it to gracefully slide back out off the screen once progress is actually "done".

Snippet:

$bPatient = _Notify_Show(64, $cmdline[2] & " loading...", "", 0, 0)
GUICtrlCreateProgress(50, 25, 100, 10, $PBS_MARQUEE)
GUICtrlSendMsg(-1, $PBM_SETMARQUEE, True, 50)
$begin = TimerInit() ; initialize timer
  While WinExists($windowname) = 0 and TimerDiff($begin) < 21000
   Sleep(225)
   If WinExists($windowname) = 1 or WinExists("Citrix online plug-in") = 1 Then ExitLoop ; once window exists, quit
  WEnd

Chad2,

We are ahead of you - $PBS_MARQUEE appears in the Progress Bar Styles in the new Beta Help file. :)

M23

I see the _Notify_Delete function is internal only, but at least in this case, there is a need to have an "external" version of that function. Thoughts?

*edit* I guess if i could get the hwnd returned for use, it would be easy enough.... any hints? I know I'm missing something simple.

*edit2* - k, figured those out.... now... need to figure out how to prevent text wrapping if using $PBS_MARQUEE (since any text wrapped will be hidden by the progress bar...)

Edited by z0iid
Link to comment
Share on other sites

  • Moderators

z0iid,

Always open to suggestions (but see below). ;)

In your case - as long as you are not showing any other Notifications at the same time - you might like to add the following line at the end of the _Notify_Show function:

Return $aNotify_Data[0][0]

This is the index of the Notification in the array of Notifications held by the UDF. To delete this Notificiation, you use _Notify_Delete and pass that index as the parameter:

#include "Notify_Mod.au3"
#include <progressconstants.au3>

HotKeySet("{ESC}", "On_Exit")

; Get the index of the Notification
$bPatient = _Notify_Show(64, "Fred" & " loading...", "", 0, 0)
GUICtrlCreateProgress(50, 25, 100, 10, $PBS_MARQUEE)
GUICtrlSendMsg(-1, $PBM_SETMARQUEE, True, 50)
$begin = TimerInit() ; initialize timer
Do
    Sleep(10)
Until TimerDiff($begin) > 2000

; And retract it
_Notify_Delete($bPatient)

While 1
    Sleep(10)
WEnd

Func On_Exit()
    Exit
EndFunc

However, this is not a general solution as there is no guarantee that another Notification will not retract during the waiting period - in which case the returned index is likely to be no longer valid as the array is ReDim'ed when this happens. Dealing with that possibility would require writing a more complex user function to search the stored array for the specific Notification handle. So, what is it worth? :) :)

M23

Edit: Easier than I thought it might be - wait until tomorrow and you might find a new release. ;)

Edited by Melba23

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

my interim solution for the notification retraction was more of a "hard coded/static" solution for this specific case - but yes, for multiple notifications it would not work. (and I chose to use the fade value instead of slide)

$bPatient = _Notify_Show(64, $cmdline[2] & " loading...", "", 0, 0) ; progressbar
GUICtrlCreateProgress(50, 25, 100, 10, $PBS_MARQUEE)
GUICtrlSendMsg(-1, $PBM_SETMARQUEE, True, 50)
$begin = TimerInit() ; initialize timer
  While WinExists($windowname) = 0 and TimerDiff($begin) < 21000
   Sleep(225)
   If WinExists($windowname) = 1 or WinExists("Citrix online plug-in") = 1 Then ExitLoop ; once window exists, quit
  WEnd
  Sleep(500)
  DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $aNotify_Data[1][0], "int", 1000, "long", 0x00090000) ; $AW_BLEND + $AW_HIDE

also, for the text wrapping issue, I ended up changing the weight of the font for the title lable (you had it at 800 for bold, which I prefer (had to change to 400)... but a long label ends up wrapping the title - even with max width set to 600)

I tried a few different fonts, but to get a "bolded" look, it ends up occasionally wrapping if my cmd parameter is too long. - 24 characters appears to be the limit before wrapping - using _Notify_Set(Default) . Maybe different with a monospaced font.

z0iid,

Always open to suggestions (but see below). :)

{trunc}

Edited by z0iid
Link to comment
Share on other sites

  • Moderators

[New Version] - 23 Feb 12

New: - _Notify_Hide function allows user to programatically retract notifications. _Notify_Show now returns handle of the notification - passing this handle to _Notify_Hide retracts it. See example for more detail. Thanks to z0iid who asked for the feature. ;)

New UDF, example and zip in 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

Melba - Thank you! Already implemented the _Notify_Hide function, and it works perfectly (of course).

Another suggestion (not a big deal, since I just modified the udf to fit my needs/wants) - but maybe another option in _Notify_Set that allows for defining show and hide/delete behavior (slide vs fade/blend) 0x00080000 for fade in, 0x00090000 for fade out - but you already knew that, and an option for slide in time/delay slide out (fade out) time/delay. (Since the AnimateWindow function is synchronous, there are times a faster slide/blend would be preferred). I ended up having to speed up the slide out time, since I'm using this on virtual desktops that use the RDP protocol (and we use high compression), the default slide out time was a bit "glitchy/stuttered".

I'm using slide in @ 350 - fade (blend) out @ 1000 - and it is beautiful.

Thanks again for this wonderful UDF - it will be implemented in as many user facing scripts as possible. :)

Link to comment
Share on other sites

  • Moderators

z0iid,

Some people are never satisifed! :);)

I will look into it - but do not hold your breath. ;)

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

definition of my ex!

yeah, no worries melba - I understand the udf well enough to be able to make those changes as I see fit - just throwing out suggestions in case you hadn't thought of those use case scenarios. i could attempt to toss in the parameter/function adjustments.... but I've never taken any formal programming classes, so I don't really know *standards* per say. While I could get it to "work", it probably wouldn't be the way a real programmer (you) would implement something.

z0iid,

Some people are never satisifed! :);)

I will look into it - but do not hold your breath. ;)

M23

Link to comment
Share on other sites

  • Melba23 changed the title to Notify - New version 17 Mar 22

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