Jump to content

Notify - New version 17 Mar 22


Melba23
 Share

Recommended Posts

  • Moderators

Adm682860,

I can only think that the error occurs when one of the internal UDF Adlib functions fires part way through the notification deletion/addition process - if this happens between the lines when the array is ReDimmed and when the count is reset then the array size and count might not match. So I have modified the UDF to temporarily cancel any active internal Adlib functions when the array in question is being modified - could you please test this Beta version and let me know if you still have the problem: :)

<snip>

Comments from any other users also welcome of course. :)

M23

Edited by Melba23
Beta code removed

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

I think something about calling _Notify_Hide() in wich called _Notify_Delete
interact with hiding other notifications by Timer in adlib

code is simple - and not victim :)

; #FUNCTION# ====================================================================================================================
Func myNotifyShow($s, $iTime = 5, $iClick = 1)
  Local $hNotify = 0, $bReset = False

  ; если в начале <!> то фон желтенький
  If StringLeft($s, 1) = "!" Then
    _Notify_Set(0, Default, 0xFFFF80, "Arial", True, Default)
    $s = StringMid($s, 2)
    $bReset = True
  EndIf

  ; если в начале <#> то
  ; #ABCDEF#ABCDEF#...
  ; #цвет текста#цвет фона#...
  If StringLeft($s, 1) = "#" Then
    _Notify_Set(0, '0x' & StringMid($s,2,6), '0x' & StringMid($s,9,6), "Arial", True, Default)
    $s = StringMid($s, 16)
    $bReset = True
  EndIf

  $hNotify = _Notify_Show(0, "", $s, $iTime, $iClick)

  If $bReset Then
    _Notify_Set(Default)
  EndIf

  If $hNotify = -1 Then
    TrayTip ( $_myProgName & ": Уведомление", $s, $iTime, 2 )
  EndIf

  Return $hNotify

EndFunc   ;==>myNotifyShow
Link to comment
Share on other sites

  • Moderators

Adm682860,

No need for the video - I believe you! :D

Try this Beta and see if you can break it. I have found another loop which depends on the array count element remaining the same and disabled the Adlib functions there as well:

<snip>

Any better? :huh:

M23

Edited by Melba23
Beta code removed

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

Adm682860,

Sorry you are still having problems, but as you appear to be the only one to report this error on a regular basis I wonder if it has something to do with the way you are using the code? :huh:

Anyway, unless you can come up with a series of actions which can reliably reproduce the error, I am at a loss as to how to debug further. Do let me know if you ever do find anything. :)

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

  • 5 weeks later...
  • Moderators

StatQuo,

Glad you find it useful. :)

To fire a custom function on a click event, I suggest you use a Global variable as a flag and then set it within the UDF's _Notify_WM_MOUSEACTIVATE function. Poll this flag in your idle loop and action your function when it is set - not forgetting to clear the flag afterwards, of course. ;)

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

  • 1 month later...

When trying to run Notify_Examples.au3 I get the following:

C:\Users\XXX\Desktop\Notify\Notify.au3(916,61) : ERROR: _GDIPlus_BitmapCreateFromScan0(): undefined function.
    $hBitmap_Resized = _GDIPlus_BitmapCreateFromScan0(32, 32)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\XXX\Desktop\Notify\Notify.au3(918,53) : ERROR: _GDIPlus_GraphicsSetInterpolationMode(): undefined function.
    _GDIPlus_GraphicsSetInterpolationMode($hBMP_Ctxt, 7)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\XXX\Desktop\Notify\Notify_Example.au3 - 3 error(s), 1 warning(s)
!>15:24:14 AU3Check ended. Press F4 to jump to next error.rc:2

Yes I moved the UDFs into my Include Folder ... anyone got the old source code or know alternative functions?

Edited by MikeWenzel
Link to comment
Share on other sites

  • Moderators

MikeWenzel,

The $__g_hGDIPDll variable was renamed within the GDI UDF during the 3.3.12.0 release last summer and I >updated the UDF to match. Upgrade your AutoIt version and it will all work nicely. If for some reason you do not want to update, just rename every instance of that variable in the UDF to $ghGDIPDll and it should work with earlier releases. :)

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

MikeWenzel,

The $__g_hGDIPDll variable was renamed within the GDI UDF during the 3.3.12.0 release last summer and I >updated the UDF to match. Upgrade your AutoIt version and it will all work nicely. If for some reason you do not want to update, just rename every instance of that variable in the UDF to $ghGDIPDll and it should work with earlier releases. :)

M23

Yeah I researched this just a second after my post. That's why I edited it. Sry for that. You got an idea how to fix the function-problem? Even caused by the AutoIIt Version?

Edited by MikeWenzel
Link to comment
Share on other sites

  • Moderators

MikeWenzel,

I imagine those functions were also renamed at the same time, but I really do not remember. The current UDF works with the current AutoIt release (I have just checked) so updating would seem to be the best way to go. ;)

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

M23

is it possible to have a WM_COMMAND that when later in the script when 

_Notify_Show(0, "", "click to stop process") is used

when clicked in example.. , it will be possible to run commands and exit

 

I want it to work independently while script commands are still running

$hNot_1 = _Notify_Show(0, "", "process started, click to stop process")

 

if possible, how would a routine for this be constructed?

thanks

Deye

Link to comment
Share on other sites

  • Moderators

Deye,

If you want to know when a notification has been clicked, I would use its handle and Adlib like this:

#include "Notify.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)

; Show notification and save handle
$hNotificationHandle = _Notify_Show(0, "Clickable", "Click to exit")

; Look for notification being closed on click
AdlibRegister("_Check_Notify")

While 1
    Sleep(10)
WEnd

Func _Check_Notify()

    If Not WinExists($hNotificationHandle) Then
        MsgBox($MB_SYSTEMMODAL, "Clicked", "Script ending")
        Exit
    EndIf

EndFunc

Func On_Exit()
    Exit
EndFunc
The script still runs while waiting and, as you can see, the closure is detected. :)

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

Deye,

If you would prefer a message-based solution you can do the following:

-1. Add a line to the _Notify_WM_MOUSEACTIVATE function to send a message when a notification is retracted:

Func _Notify_WM_MOUSEACTIVATE($hWnd, $iMsg, $wParam, $lParam)

    #forceref $iMsg, $wParam, $lParam

    ; Check timer is not checking
    If $aNotify_RetractMode[0] Then
        Return
    EndIf
    ; Check handler not already retracting
    If $aNotify_RetractMode[1] Then
        Return
    EndIf
    ; Set flag to show handler retracting
    $aNotify_RetractMode[1] = True

    For $i = $aNotify_Data[0][0] To 1 Step -1
        ; Is it a click on a notification?
        If $hWnd = $aNotify_Data[$i][0] Then
            $aNotify_Data[0][5] = $i
            If $aNotify_Data[$i][5] Then
                ; Extend the notification
                AdlibRegister("_Notify_Extend", 100)
            Else
                ; Delete the notification if clickable
                If $aNotify_Data[$i][3] Then
                    AdlibRegister("_Notify_Delete", 100)

                    _WinAPI_PostMessage($hWnd, 0x0444, $hWnd, 0) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

                EndIf
            EndIf
            ExitLoop
        EndIf
    Next

    ; Clear Running flag
    $aNotify_RetractMode[1] = False

    Return "GUI_RUNDEFMSG"

EndFunc   ;==>_Notify_WM_MOUSEACTIVATE
- 2. Register a user message function in your script and look for the sent message from the selected notification like this:

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

Opt("TrayAutoPause", 0)

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

; Register a user message
GUIRegisterMsg(0x0444, "_Notify_WM_USER0444") ; In $WM_USER range

; Show notifications
_Notify_RegMsg()
_Notify_Locate(0)
$hNotify_Exit = _Notify_Show(0, "Notify 1", "Click registered") ; This is the one which will fire when retracted
_Notify_Show(0, "Notify 2", "Click ignored")

While 1
    Sleep(10)
WEnd

Func _Notify_WM_USER0444($hWnd, $iMsg, $wParam, $lParam)
    ; Check if handle of clicked notification matches the one we want
    If $wParam = $hNotify_Exit Then
        ConsoleWrite("Time to go!" & @CRLF)
    EndIf
EndFunc

Func On_Exit()
    Exit
EndFunc
I am not adding this to the UDF as it is outside of its "notification" scope and the Adlib method above is perfectly useable. But it was a fun little project for a rainy morning. :)

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 months later...
  • Moderators

TheDcoder,

Did that happen when you ran the supplied example or your own code? If the latter then you know what to do...

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

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