Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Notify - New version 30 Jan 13


  • Please log in to reply
81 replies to this topic

#21 comptessa

comptessa

    Seeker

  • New Members
  • 1 posts

Posted 18 January 2012 - 02:57 AM

This is great.
I'm definetely including this within my software deployments.

Software success = notify "Software Installed."

MsgBox wouldn't be as elegant of an option.. but this springs ideas.

Thanks a lot.

- tessa







#22 czardas

czardas

  • Active Members
  • PipPipPipPipPipPip
  • 6,517 posts

Posted 31 January 2012 - 12:05 PM

I have made use of this in my win-1252 extended ascii keyboard. Thanks again!

#23 z0iid

z0iid

    Seeker

  • Active Members
  • 28 posts

Posted 04 February 2012 - 12:16 AM

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?

#24 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 19,892 posts

Posted 04 February 2012 - 09:32 AM

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
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#25 z0iid

z0iid

    Seeker

  • Active Members
  • 28 posts

Posted 06 February 2012 - 11:28 PM

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.

#26 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 19,892 posts

Posted 07 February 2012 - 09:20 AM

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
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#27 z0iid

z0iid

    Seeker

  • Active Members
  • 28 posts

Posted 07 February 2012 - 08:58 PM

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.

#28 czardas

czardas

  • Active Members
  • PipPipPipPipPipPip
  • 6,517 posts

Posted 10 February 2012 - 11:14 AM

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, 10 February 2012 - 11:52 AM.


#29 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 19,892 posts

Posted 10 February 2012 - 12:00 PM

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
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#30 czardas

czardas

  • Active Members
  • PipPipPipPipPipPip
  • 6,517 posts

Posted 10 February 2012 - 12:03 PM

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, 10 February 2012 - 12:19 PM.


#31 Chad2

Chad2

    Seeker

  • Active Members
  • 24 posts

Posted 10 February 2012 - 09:10 PM

To toast or to notify. That is the question.

Thanks again. Excellent work. I think I learn more from just reading the code and understanding better coding methods.

#32 Chad2

Chad2

    Seeker

  • Active Members
  • 24 posts

Posted 10 February 2012 - 09:22 PM

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

#33 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 19,892 posts

Posted 10 February 2012 - 09:27 PM

Chad2,

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

M23
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#34 z0iid

z0iid

    Seeker

  • Active Members
  • 28 posts

Posted 22 February 2012 - 12:30 AM

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, 22 February 2012 - 03:58 PM.


#35 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 19,892 posts

Posted 22 February 2012 - 04:03 PM

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:
AutoIt         
#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, 22 February 2012 - 05:50 PM.

StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#36 z0iid

z0iid

    Seeker

  • Active Members
  • 28 posts

Posted 22 February 2012 - 05:54 PM

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, 22 February 2012 - 07:28 PM.


#37 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 19,892 posts

Posted 23 February 2012 - 10:17 AM

[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
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#38 z0iid

z0iid

    Seeker

  • Active Members
  • 28 posts

Posted 23 February 2012 - 04:28 PM

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

#39 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 19,892 posts

Posted 23 February 2012 - 04:34 PM

z0iid,

Some people are never satisifed! :) ;)

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

M23
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#40 z0iid

z0iid

    Seeker

  • Active Members
  • 28 posts

Posted 23 February 2012 - 07:03 PM

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






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users