Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Notify() - multiple easy tray area notifications - v0.4991


  • Please log in to reply
319 replies to this topic
gwarble
  • Members
  • 624 posts
  • Last active: Aug 12 2016 07:49 PM
  • Joined: 23 May 2009
So not having to use unique gui numbers with _L will simplify the code, is there anything new in _L that will help me remove the quantity of labels like (while still using varying timer lengths):
Notify_Kill_1:
Notify_Kill_2:
Notify_Kill_3:
...
Notify_Kill_25:
...
Return
Anyone know?

guest3456
  • Members
  • 1704 posts
  • Last active: Nov 19 2015 11:58 AM
  • Joined: 10 Mar 2011
bug?

it seems that Gui's arent getting destroyed and re-allocated or something. keep pressing this hotkey to turn on/off numerous times. eventually you'll get an error as you see the tooltip increase
 
#NoEnv 
#include Notify.ahk


Esc::
   ExitApp
return


F7::
   Suspend, Toggle
   
   if ( A_IsSuspended )
   {
      Notify("", "", 0, "Wait=" . EnabledHotkeysNotifyID)  ;// close the ENABLED notification
      DisabledHotkeysNotifyID := Notify(" Hotkeys are DISABLED ", " Press " . A_ThisHotkey . " again to enable ", 0, "GC=202020 TF=Verdana TS=10 TC=FAFAFA TW=400 MF=Verdana MS=8 MC=FAFAFA MW=400 BT=200 BK=Silver SI=100 SC=100")
      ToolTip, DisabledHotkeysNotifyID=%DisabledHotkeysNotifyID%
   }
   else 
   {
      Notify("", "", 0, "Wait=" . DisabledHotkeysNotifyID)  ;// close the DISABLED notification
      EnabledHotkeysNotifyID := Notify(" Hotkeys are ENABLED ", "", 1, "GC=202020 TF=Verdana TS=10 TC=FAFAFA TW=400 MF=Verdana MS=8 MC=FAFAFA MW=400 BT=200 BK=Silver SI=100 SC=100")
      ToolTip, EnabledHotkeysNotifyID=%EnabledHotkeysNotifyID%
   }
return 
or am i doing something wrong?

it looks like there is one place in Notify() where you do a Gui, Destroy but you don't clean up the GNList. its near the top in the if Wait is Number portion:
 
            Gui, % Wait + GL - GF + 1 ":Destroy"	; destroys border gui
            If ST
              DllCall("AnimateWindow","UInt",NotifyGuiID,"Int",ST,"UInt","0x00050001") ; slides window out to the right if ST or SC are used
            Gui, %Wait%:Destroy		; and destroys it
            StringReplace, GNList, GNList, % "|" Wait, , All   ;// <--------- SHOULD THIS BE ADDED?
when i add that line above, then re-run the test script at the top of this post, the tooltip looks good and keeps reusing the same gui number

gwarble
  • Members
  • 624 posts
  • Last active: Aug 12 2016 07:49 PM
  • Joined: 23 May 2009
Looks like you found the problem, thanks!

I'll confirm on my end, but looks good to me
I believe there is a bug when "wait=" a notify that has already been clicked or hasnt been created, but maybe not

HockeyZ39
  • Members
  • 14 posts
  • Last active: Oct 25 2013 04:01 AM
  • Joined: 15 Dec 2012

I changed up the _Notify_Action_Clicked_ label a bit to stop the flash on single click, close the notification on double click, and allow notification dragging. Could be another OPTION that could be added. 

 

Once again, thanks for the function. It has been extremely helpful.

;option AC=Label will be called here when clicked
_Notify_Action_Clicked_: 
    ;Disable flash on single click
    SetTimer, % "_Notify_Flash_" A_Gui - GF + 1, Off
    Gui, % A_Gui + GL - GF + 1 ":Destroy"
    ;Enable GUI window dragging 
    PostMessage, 0xA1, 2,,, A 

    ;Close GUI on Double Click
    If (A_GuiEvent = "DoubleClick") { 
        SetTimer, % "_Notify_Kill_" A_Gui - GF + 1, Off
        If SC
        {
            Gui, %A_Gui%:+LastFound
            DllCall("AnimateWindow","UInt",WinExist(),"Int",SC,"UInt", "0x10010") ; hide-center animation
        }
        Gui, %A_Gui%:Destroy
        If (ACList)
        Loop,Parse,ACList,|
            If ((Action := SubStr(A_LoopField,1,2)) = A_Gui) {
                Temp_Notify_Action:= SubStr(A_LoopField,4)
                StringReplace, ACList, ACList, % "|" A_Gui "=" Temp_Notify_Action, , All
                vvv := A_Gui
                If IsLabel(_Notify_Action := Temp_Notify_Action)
                    Gosub, %_Notify_Action%
                _Notify_Action =
                Break
            }
        StringReplace, GNList, GNList, % "|" A_Gui, , All
        If (Exit = A_Gui)
            ExitApp
    }
Return


Trubbleguy
  • Members
  • 122 posts
  • Last active: Jan 15 2017 10:50 AM
  • Joined: 20 Jan 2007

is the first post being updated with all these fixes?



HockeyZ39
  • Members
  • 14 posts
  • Last active: Oct 25 2013 04:01 AM
  • Joined: 15 Dec 2012

I also made the following modifications to the _Notify_Kill_ label(s) to get the X-Clicked (AX) and Timeout (AT) label options functioning. There is probably an easier way to go about it, but it gets the job done for me. :)

    _Notify_Kill_25:
        Critical
        StringReplace, GK, A_ThisLabel, _Notify_Kill_
        SetTimer, %A_ThisLabel%, Off  ; stop timeout label from running when x is clicked.
        SetTimer, _Notify_Flash_%GK%, Off
        GK := GK + GF - 1
        Gui, % GK + GL - GF + 1 ":Destroy"
        If ST
        {
            Gui, %GK%:+LastFound
            DllCall("AnimateWindow","UInt",WinExist(),"Int",ST,"UInt", "0x00050001")
        }
        Gui, %GK%:Destroy

        If (A_GuiEvent = "Normal") {  ; if X was clicked check for xclick Label
            If (AXList)
                Loop,Parse,AXList,|
                    If ((ActionX := SubStr(A_LoopField,1,2)) = GK)
                    {
                        Temp_Notify_ActionX:= SubStr(A_LoopField,4)
                        StringReplace, AXList, AXList, % "|" GK "=" Temp_Notify_ActionX, , All
                        vvx := GK
                        If IsLabel(_Notify_ActionX := Temp_Notify_ActionX)
                            Gosub, %_Notify_ActionX%
                        _Notify_ActionX =
                        Break
                    }
        }
        Else {                        ; else check for timeout Label
            If (ATList)
                Loop,Parse,ATList,|
                    If ((ActionT := SubStr(A_LoopField,1,2)) = GK)
                    {
                        Temp_Notify_ActionT:= SubStr(A_LoopField,4)
                        StringReplace, ATList, ATList, % "|" GK "=" Temp_Notify_ActionT, , All
                        vvt := GK
                        If IsLabel(_Notify_ActionT := Temp_Notify_ActionT)
                            Gosub, %_Notify_ActionT%
                        _Notify_ActionT =
                        Break
                    }
        }
        
        StringReplace, GNList, GNList, % "|" GK, , All
        If (Exit = GK)
            ExitApp
    Return 1


Larctic
  • Members
  • 303 posts
  • Last active: May 10 2016 04:56 PM
  • Joined: 21 Jul 2012
I ask, is there a plan to launch a version for V2? V2 is being gradually promoted.

gwarble
  • Members
  • 624 posts
  • Last active: Aug 12 2016 07:49 PM
  • Joined: 23 May 2009
Thanks all for the improvements/additions/fixes... I will try to get a new version up soon with them

No plans for a v2 specific version at this point...

- gwarble

Cruncher1
  • Members
  • 104 posts
  • Last active: Oct 05 2017 05:11 PM
  • Joined: 21 Feb 2012

Thanks for sharing, this looks very promising and I look forward to using it!    :)



Skrell
  • Members
  • 384 posts
  • Last active: Jul 07 2016 05:03 PM
  • Joined: 23 Aug 2011

Holy crap this is impressive!!



newbieme
  • Members
  • 100 posts
  • Last active: Aug 07 2015 11:22 AM
  • Joined: 26 Mar 2014

Nice job!

 

Is there a way to move notify windows by x y coordinates?



lalle_aa
  • Members
  • 3 posts
  • Last active: Aug 15 2014 08:22 AM
  • Joined: 23 Jul 2014

I cannot get the "Update" to work. Every time i try to update i get an "Error: Too many parameters passed to function". What am i doing wrong?

 

The line with the error:

Notify(Info2, Info1, 5, "Update", NotifyID)

 

(Info1 and Info2 are strings)

 

Thanks in advance!



m3nth0l
  • Members
  • 27 posts
  • Last active: Feb 13 2015 11:34 PM
  • Joined: 19 Oct 2011

Try this:

Notify(Info2, Info1, 5, "Update=", NotifyID)


lalle_aa
  • Members
  • 3 posts
  • Last active: Aug 15 2014 08:22 AM
  • Joined: 23 Jul 2014

 

Try this:

Notify(Info2, Info1, 5, "Update=", NotifyID)

 

I still get "Error: Too many parameters passed to function"...

Thanks for the answer though!



m3nth0l
  • Members
  • 27 posts
  • Last active: Feb 13 2015 11:34 PM
  • Joined: 19 Oct 2011

I still get "Error: Too many parameters passed to function"...

Thanks for the answer though!

 

Sorry! forgot to change the comma :D

Notify(Info2, Info1, 5, "Update=" . NotifyID)