hey man, try this, or post some code so i can see what you're trying:
Code:
#SingleInstance Force
Notify()
Notify("Welcome to Notify()","That first notification had no parameters.`nClick this notification to open a new one...",0,"AC=ActionDemo IN=8 IW=48 IH=48", A_WinDir "\explorer.exe")
Return
ActionDemo:
HotKey, ^F12, WaitDemo
NotifyID := Notify("","this one is permanent, press ctrl-F12 to force kill after 3 seconds",0)
Return
WaitDemo:
Notify("","",-3,"Wait",NotifyID)
Notify("It should have disappeared after 3 seconds, even though it had 0 duration!","this notification will exitapp if clicked or times out",-10)
Return
#Include Notify.ahk
and get this newest version:
Code:
;;;;;
;;; Notify() 0.42 - made by gwarble - sept 09
;;
; for displaying multiple customizable tray area notifications
;
; thanks to Rhys, engunneer, and HugoV
;
;
; Notify([Title,Message,Duration,Options,Image])
;
; Parameters: - Default - Notes
;
; Title - "Notification!!!" - "" to omit title line
;
; Message - "" - "" to omit message line
;
; Duration - 15 - 0 to flash until clicked
; <0 to ExitApp on click/timeout
; -0 not yet implemented
; Options - GF=50 GL=74 - string of options
; uses ((GL-GF)*2) Gui Numbers
; ie: 50 thru 99 by defaults
; [see function for all] most options static/remembered
; "NO=Reset" to reset options
; see function for details
; Image - shell32.dll (1<Image<255) - Image file, or
; number of icon in shell32.dll
;
; Returns - Gui Number used, 0 if Gui quantity exceeded
;
;
Notify(Title="Notification!!!",Message="",Duration=15,Options="",Image="")
{
Static ;Options string, eg: "TS=12 GC=Blue"
; Critical
static GF := 50 ;GF is Gui First Number
static GL := 74 ;GM is Gui Last Number
static GC := "FFFFAA" ;GC is Gui Color
static GR := 9 ;GR is Gui Radius
static GT := "Off" ;GT is Gui Transparency
static TS := 8 ;TS is Title Font Size
static TW := 625 ;TW is Title Font Weight
static TC := "Black" ;TC is Title Font Color
static TF := "Arial" ;TF is Title Font
static MS := 8 ;MS is Message Font Size
static MW := 550 ;MW is Message Font Weight
static MC := "Black" ;MC is Message Font Color
static MF := "Arial" ;MF is Message Font
static BC := "Black" ;BC is Border Colors
static BW := 2 ;BW is Border Width/Thickness
static BR := 9 ;BR is Border Radius
static BT := 105 ;BT is Border Transpacency
static BF := 150 ;BF is Border Flash Speed
static SI := 350 ;SI is Speed In (AnimateWindow)
static SC := 100 ;SC is Speed Clicked (AnimateWindow)
static ST := 450 ;SO is Speed TimeOut (AnimateWindow)
static IW := 32 ;IW is Image Width
static IH := 32 ;IH is Image Height
static IN := 0 ;IN is Icon Number
static Defaults := "GF=50 GL=74 GC=FFFFAA GR=9 GT=Off TS=8 TW=625 TC=Black TF=Arial MS=8 MW=550 MC=Black MF=Arial BC=Black BW=2 BR=9 BT=105 BF=150 SC=300 SI=250 ST=100 IW=32 IH=32 IN=0"
local AC ;AC is Action Clicked
local AT ;AT is Action Timeout (broken)
local Notify_Action, ImageOptions, GY, OtherY
;==========================================================================
Notify: ;========================================= when Notify() is called:
local NO := 0 ;NO is Notify Option [NO=Reset]
If (Options)
{
IfInString, Options, =
{
Loop,Parse,Options,%A_Space%
If (Option:= SubStr(A_LoopField,1,2))
%Option%:= SubStr(A_LoopField,4)
If NO = Reset
{
Options := Defaults
Goto, Notify
}
}
Else If Options = Wait
Goto, Notify_Wait
}
GN := GF
Loop
IfNotInString, NotifyList, % "|" GN
Break
Else
If (++GN > GL)
Return 0 ;=== too many notifications open!
NotifyList .= "|" GN
GN2 := GN + GL - GF + 1
If (AC)
ActionList .= "|" GN "=" AC
Prev_DetectHiddenWindows := A_DetectHiddenWindows
Prev_TitleMatchMode := A_TitleMatchMode
DetectHiddenWindows On
SetTitleMatchMode 1
If (WinExist("NotifyGui")) ;=== find all Notifications from ALL scripts, for placement
WinGetPos, OtherX, OtherY ;=== change this to a loop for all open notifications?
DetectHiddenWindows %Prev_DetectHiddenWindows%
SetTitleMatchMode %Prev_TitleMatchMode%
Gui, %GN%:-Caption +ToolWindow +AlwaysOnTop -Border
Gui, %GN%:Color, %GC%
Gui, %GN%:Font, w%TW% s%TS% c%TC%, %TF%
If (Image)
{
If FileExist(Image)
Gui, %GN%:Add, Picture, w%IW% h%IH% Icon%IN%, % Image
Else
Gui, %GN%:Add, Picture, w%IW% h%IH% Icon%Image%, c:\windows\system32\shell32.dll
ImageOptions = x+10
}
If (Title)
Gui, %GN%:Add, Text, % ImageOptions, % Title
Gui, %GN%:Font, w%MW% s%MS% c%MC%, %MF%
If ((Title) && (Message))
Gui, %GN%:Margin, , -5
If (Message)
Gui, %GN%:Add, Text,, % Message
If ((Title) && (Message))
Gui, %GN%:Margin, , 8
Gui, %GN%:Show, Hide, NotifyGui
Gui %GN%:+LastFound
WinGetPos, GX, GY, GW, GH
Gui, %GN%:Add, Text, x0 y0 w%GW% h%GH% gNotify_Action BackgroundTrans
If (GR)
WinSet, Region, % "0-0 w" GW " h" GH " R" GR "-" GR
If (GT)
WinSet, Transparent, % GT
SysGet, Workspace, MonitorWorkArea
NewX := WorkSpaceRight-GW-5
If (OtherY)
NewY := OtherY-GH-5
Else
NewY := WorkspaceBottom-GH-5
If NewY < % WorkspaceTop
NewY := WorkspaceBottom-GH-5
Gui, %GN2%:-Caption +ToolWindow +AlwaysOnTop -Border +E0x20
Gui, %GN2%:Color, %BC%
Gui %GN2%:+LastFound
If (BR)
WinSet, Region, % "0-0 w" GW+(BW*2) " h" GH+(BW*2) " R" BR "-" BR
If (BT)
WinSet, Transparent, % BT
Gui, %GN2%:Show, % "Hide x" NewX-BW " y" NewY-BW " w" GW+(BW*2) " h" GH+(BW*2)
Gui, %GN%:Show, % "Hide x" NewX " y" NewY, NotifyGui
Gui %GN%:+LastFound
If SI
DllCall("AnimateWindow","UInt",WinExist(),"Int",SI,"UInt","0x00040008")
Else
Gui, %GN%:Show,, NotifyGui
Gui, %GN2%:Show, NA
WinSet, AlwaysOnTop, On
If Duration < 0
Exit := GN
If (Duration)
SetTimer, % "NotifyKill" GN - GF + 1, % - Abs(Duration) * 1000
Else
SetTimer, % "NotifyFlash" GN - GF + 1, % BF
Return % GN
;==========================================================================
;========================================== when a notification is clicked:
Notify_Action:
;Critical
SetTimer, % "NotifyKill" A_Gui - GF + 1, Off
Gui, % A_Gui + GL - GF + 1 ":Destroy"
Gui %A_Gui%:+LastFound
If SC
DllCall("AnimateWindow","UInt",WinExist(),"Int",SC,"UInt", "0x00050001")
Gui, %A_Gui%:Destroy
If (ActionList)
Loop,Parse,ActionList,|
If ((Action := SubStr(A_LoopField,1,2)) = A_Gui)
{
TempNotify_Action:= SubStr(A_LoopField,4)
StringReplace, ActionList, ActionList, % "|" A_Gui "=" TempNotify_Action, , All
If IsLabel(Notify_Action := TempNotify_Action)
Gosub, %Notify_Action%
Notify_Action =
Break
}
StringReplace, NotifyList, NotifyList, % "|" GN, , All
SetTimer, % "NotifyFlash" A_Gui - GF + 1, Off
If (Exit = A_Gui)
ExitApp
Return
;==========================================================================
;=========================================== when a notification times out:
NotifyKill1:
NotifyKill2:
NotifyKill3:
NotifyKill4:
NotifyKill5:
NotifyKill6:
NotifyKill7:
NotifyKill8:
NotifyKill9:
NotifyKill10:
NotifyKill11:
NotifyKill12:
NotifyKill13:
NotifyKill14:
NotifyKill15:
NotifyKill16:
NotifyKill17:
NotifyKill18:
NotifyKill19:
NotifyKill20:
NotifyKill21:
NotifyKill22:
NotifyKill23:
NotifyKill24:
NotifyKill25:
;Critical
StringReplace, GK, A_ThisLabel, NotifyKill
SetTimer, NotifyFlash%GK%, Off
GK += GF - 1
Gui, % GK + GL - GF + 1 ":Destroy"
Gui %GK%:+LastFound
If ST
DllCall("AnimateWindow","UInt",WinExist(),"Int",ST,"UInt", "0x00050001")
Gui, %GK%:Destroy
StringReplace, NotifyList, NotifyList, % "|" GK
If (Exit = GK)
ExitApp
Return
;==========================================================================
;======================================== flashes a permanent notification:
NotifyFlash1:
NotifyFlash2:
NotifyFlash3:
NotifyFlash4:
NotifyFlash5:
NotifyFlash6:
NotifyFlash7:
NotifyFlash8:
NotifyFlash9:
NotifyFlash10:
NotifyFlash11:
NotifyFlash12:
NotifyFlash13:
NotifyFlash14:
NotifyFlash15:
NotifyFlash16:
NotifyFlash17:
NotifyFlash18:
NotifyFlash19:
NotifyFlash20:
NotifyFlash21:
NotifyFlash22:
NotifyFlash23:
NotifyFlash24:
NotifyFlash25:
StringReplace, FlashGN, A_ThisLabel, NotifyFlash
FlashGN += GF - 1
FlashGN2 := FlashGN + GL - GF + 1
If Flashed%FlashGN2% := !Flashed%FlashGN2%
Gui, %FlashGN2%:Color, Silver
Else
Gui, %FlashGN2%:Color, Black
Return
;==========================================================================
;============================= wait (or force) for a notification to close:
Notify_Wait:
;Critical
If (Image)
{
Gui %Image%:+LastFound
If NotifyGuiID := WinExist()
{
WinWaitClose, , , % Abs(Duration)
If (ErrorLevel && Duration < 1)
{
Gui, % Image + GL - GF + 1 ":Destroy"
DllCall("AnimateWindow","UInt",NotifyGuiID,"Int",100,"UInt", "0x00050001")
Gui, %Image%:Destroy
}
}
}
Else
Notify("No Notification specified to wait for!","waiting for all notifications is not yet implemented",10,"IN=8",A_WinDir "\explorer.exe")
Return
}
- gwarble
the flow according to your last post should probably be:
Code:
NID := Notify(T,M,0)
; actions
Notify("","",-1,"Wait",NID) ;=force kill NID notification before proceeding
NID := Notify(T,"Finished!",5)
or something like that...