Jump to content
Sign in to follow this  
Zibit

Tray Popup GUI UDF

Recommended Posts

Zibit

you know those MSN and other messanger type logon Gui's. they just pop up on to your screen that you friend has logged on... well i made an 2 function UDF ( planning to make more when i have the time ). Well i didnt find any more of these so i might be the first :party:

you will find the description inside the script but theres 2 functions

* tray_gui("your title", "your text", (sound 1 or 0)) - this is just for showing no functions will happen by clicking on it

* tray_func("your title", "your text", "myfunc", (sound 1 or 0)) - by clicking on it, it will run a function which is a func soo make your function named that :party:

* tray_side("your title", "your text", (sound 1 or 0)) - tray side just pops from the right side of your screen and it's no function

* tray_sidefunc("your title", "your text", "yourfunc", (sound 1 or 0)) - same as tray side but it is with func like tray_func it calls your function on click :mellow:

Version 0.2

#Include <Misc.au3>
#Include <WinAPI.au3>
#include <Constants.au3>
#include <WindowsConstants.au3>
#comments-start
usage: 
sound = either 1 is on and 0 is off
tray_gui("my title", "my text", $sound)
this is no click function. just for showing.
tray_func("my title", "my text", $sound)
it runs a function mouseclickfunc() and that function is the function
you want to happen when client clicks on the traygui.
examples:
tray_gui("Welcome", "Your friend has logged in", 1)
tray_func("Welcome", "Your friend has logged in! Chat with him ?", "myfunc", 0)
tray_side("Welcome", "Your friend has logged in", 0)
tray_sidefunc("Welcome", "Your friend has logged in! Chat with him ?", "_func", 1)
#comments-end


Func tray_gui($title, $text, $sound)
    Opt("GUICoordMode", 0)
    if FileExists(@ScriptDir & "\data\tray.wma") = True Then
    if $sound = 1 then SoundPlay(@ScriptDir & "\data\tray.wma", 0)
    endif
    $i = 0
        $gui = GUICreate("popup", 200, 70, 850, 650, BitOR($WS_POPUPWINDOW, $WS_THICKFRAME), BitOR($WS_EX_CLIENTEDGE, $WS_EX_TOOLWINDOW))
        GUISetState(@SW_SHOW)
        ConsoleWrite($i & @CRLF)
    GUISetBkColor(0xE0FFFF)
    WinSetTrans("popup", "", 0)
    $rgn = _WinAPI_CreateRoundRectRgn(6, 6, 200, 70, 60, 40)
    _WinAPI_SetWindowRgn($gui, $rgn)
    GUISetFont(9, 800, 4)
    GUICtrlCreateLabel($title, 10, 7, 190, 20)
    GUISetFont(7, 600, 0)
    GUICtrlCreateLabel($text, 5, 23, 190, 40)
    Do
    $i = $i + 5
    WinSetTrans("popup", "", $i)
    sleep(10)
    until $i = 255
    sleep(5000)
    Do
    $i = $i - 5
    WinSetTrans("popup", "", $i)
    sleep(10)
    until $i = 0
    GUIDelete($gui)
EndFunc

Func tray_func($title, $text, $func, $sound)
    $dll = DllOpen("user32.dll")
    Opt("GUICoordMode", 0)
    if FileExists(@ScriptDir & "\data\tray.wma") = True then
    if $sound = 1 then SoundPlay(@ScriptDir & "\data\tray.wma", 0)
    endif
    $i = 0
        $gui = GUICreate("popup", 200, 70, 850, 650, BitOR($WS_POPUPWINDOW, $WS_THICKFRAME), BitOR($WS_EX_CLIENTEDGE, $WS_EX_TOOLWINDOW))
        GUISetState(@SW_SHOW)
        ConsoleWrite($i & @CRLF)
    GUISetBkColor(0xE0FFFF)
    WinSetTrans("popup", "", 0)
    $rgn = _WinAPI_CreateRoundRectRgn(6, 6, 200, 70, 60, 40)
    _WinAPI_SetWindowRgn($gui, $rgn)
    GUISetFont(9, 800, 4)
    GUICtrlCreateLabel($title, 10, 7, 190, 20)
    GUISetFont(7, 600, 0)
    GUICtrlCreateLabel($text, 5, 23, 190, 40)
    Do
    $i = $i + 5
    WinSetTrans("popup", "", $i)
    sleep(10)
    until $i = 255
    $n = 0
    Do
    sleep(10)
    $n = $n + 1
    $pos = MouseGetPos()
    if $pos[0] > 850 and $pos[1] > 650 then
    if _IsPressed("01", $dll) = True Then
    GUIDelete($gui)
    Call($func)
    ExitLoop
    EndIf
    endif
    Until $n = 500
    Do
    $i = $i - 5
    WinSetTrans("popup", "", $i)
    sleep(10)
    until $i = 0
    GUIDelete($gui)
EndFunc

Func tray_side($title, $text, $sound)
    Opt("GUICoordMode", 0)
    if FileExists(@ScriptDir & "\data\tray.wma") = True Then
    if $sound = 1 then SoundPlay(@ScriptDir & "\data\tray.wma", 0)
    endif
    $i = 950
        $gui = GUICreate("popup", 200, 70, 850, 650, BitOR($WS_POPUPWINDOW, $WS_THICKFRAME), BitOR($WS_EX_CLIENTEDGE, $WS_EX_TOOLWINDOW))
        GUISetState(@SW_SHOW)
        ConsoleWrite($i & @CRLF)
    GUISetBkColor(0xE0FFFF)
    WinSetTrans("popup", "", 230)
    $rgn = _WinAPI_CreateRoundRectRgn(6, 6, 200, 70, 60, 40)
    _WinAPI_SetWindowRgn($gui, $rgn)
    GUISetFont(9, 800, 4)
    GUICtrlCreateLabel($title, 10, 7, 190, 20)
    GUISetFont(7, 600, 0)
    GUICtrlCreateLabel($text, 5, 23, 190, 40)
    Do
        $i = $i - 1
        _WinAPI_SetWindowPos($gui, "", $i, 650, 200, 70, $SWP_SHOWWINDOW)
        sleep(10)
    until $i = 850
    sleep(5000)
    Do
        $i = $i + 1
        _WinAPI_SetWindowPos($gui, "", $i, 650, 200, 70, $SWP_SHOWWINDOW)
        sleep(10)
    until $i = 900
    GUIDelete($gui)
EndFunc
Func tray_sidefunc($title, $text, $func, $sound)
    $dll = DllOpen("user32.dll")
    Opt("GUICoordMode", 0)
    if FileExists(@ScriptDir & "\data\tray.wma") = True then
    if $sound = 1 then SoundPlay(@ScriptDir & "\data\tray.wma", 0)
    endif
    $i = 0
        $gui = GUICreate("popup", 200, 70, 850, 650, BitOR($WS_POPUPWINDOW, $WS_THICKFRAME), BitOR($WS_EX_CLIENTEDGE, $WS_EX_TOOLWINDOW))
        GUISetState(@SW_SHOW)
        ConsoleWrite($i & @CRLF)
    GUISetBkColor(0xE0FFFF)
    WinSetTrans("popup", "", 230)
    $rgn = _WinAPI_CreateRoundRectRgn(6, 6, 200, 70, 60, 40)
    _WinAPI_SetWindowRgn($gui, $rgn)
    GUISetFont(9, 800, 4)
    GUICtrlCreateLabel($title, 10, 7, 190, 20)
    GUISetFont(7, 600, 0)
    GUICtrlCreateLabel($text, 5, 23, 190, 40)
    $i = 900
    Do
        $i = $i - 1
        _WinAPI_SetWindowPos($gui, "", $i, 650, 200, 70, $SWP_SHOWWINDOW)
        sleep(10)
    until $i = 850
    $n = 0
    Do
    sleep(10)
    $n = $n + 1
    $pos = MouseGetPos()
    if $pos[0] > 850 and $pos[1] > 650 then
    if _IsPressed("01", $dll) = True Then
    GUIDelete($gui)
    Call($func)
    ExitLoop
    EndIf
    endif
    Until $n = 500
    Do
        $i = $i + 1
        _WinAPI_SetWindowPos($gui, "", $i, 650, 200, 70, $SWP_SHOWWINDOW)
        sleep(10)
    until $i = 900
    GUIDelete($gui)
EndFunc

Version 0.1

#Include <Misc.au3>
#Include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#comments-start
usage: 
sound = either 1 is on and 0 is off
tray_gui("my title", "my text", $sound)
this is no click function. just for showing.
tray_func("my title", "my text", $sound)
it runs a function mouseclickfunc() and that function is the function
you want to happen when client clicks on the traygui.
examples:
tray_gui("Welcome", "Your friend has logged in", 1)
tray_func("Welcome", "Your friend has logged in! Chat with him ?", 0)
tray_side("Welcome", "Your friend has logged in", 0)
tray_sidefunc("Welcome", "Your friend has logged in! Chat with him ?", 1)
#comments-end


Func tray_gui($title, $text, $sound)
    Opt("GUICoordMode", 0)
    if FileExists(@ScriptDir & "\data\tray.wma") = True Then
    if $sound = 1 then SoundPlay(@ScriptDir & "\data\tray.wma", 0)
    endif
    $i = 0
        $gui = GUICreate("popup", 200, 70, 850, 650, BitOR($WS_POPUPWINDOW, $WS_THICKFRAME), BitOR($WS_EX_CLIENTEDGE, $WS_EX_TOOLWINDOW))
        GUISetState(@SW_SHOW)
        ConsoleWrite($i & @CRLF)
    GUISetBkColor(0xE0FFFF)
    WinSetTrans("popup", "", 0)
    $rgn = _WinAPI_CreateRoundRectRgn(6, 6, 200, 70, 60, 40)
    _WinAPI_SetWindowRgn($gui, $rgn)
    GUISetFont(9, 800, 4)
    GUICtrlCreateLabel($title, 10, 7, 190, 20)
    GUISetFont(7, 600, 0)
    GUICtrlCreateLabel($text, 5, 23, 190, 40)
    Do
    $i = $i + 5
    WinSetTrans("popup", "", $i)
    sleep(10)
    until $i = 255
    sleep(5000)
    Do
    $i = $i - 5
    WinSetTrans("popup", "", $i)
    sleep(10)
    until $i = 0
    GUIDelete($gui)
EndFunc

Func tray_func($title, $text, $sound)
    $dll = DllOpen("user32.dll")
    Opt("GUICoordMode", 0)
    if FileExists(@ScriptDir & "\data\tray.wma") = True then
    if $sound = 1 then SoundPlay(@ScriptDir & "\data\tray.wma", 0)
    endif
    $i = 0
        $gui = GUICreate("popup", 200, 70, 850, 650, BitOR($WS_POPUPWINDOW, $WS_THICKFRAME), BitOR($WS_EX_CLIENTEDGE, $WS_EX_TOOLWINDOW))
        GUISetState(@SW_SHOW)
        ConsoleWrite($i & @CRLF)
    GUISetBkColor(0xE0FFFF)
    WinSetTrans("popup", "", 0)
    $rgn = _WinAPI_CreateRoundRectRgn(6, 6, 200, 70, 60, 40)
    _WinAPI_SetWindowRgn($gui, $rgn)
    GUISetFont(9, 800, 4)
    GUICtrlCreateLabel($title, 10, 7, 190, 20)
    GUISetFont(7, 600, 0)
    GUICtrlCreateLabel($text, 5, 23, 190, 40)
    Do
    $i = $i + 5
    WinSetTrans("popup", "", $i)
    sleep(10)
    until $i = 255
    $n = 0
    Do
    sleep(10)
    $n = $n + 1
    $pos = MouseGetPos()
    if $pos[0] > 850 and $pos[1] > 650 then
    if _IsPressed("01", $dll) = True Then
    GUIDelete($gui)
    mouseclickfunc()
    ExitLoop
    EndIf
    endif
    Until $n = 500
    Do
    $i = $i - 5
    WinSetTrans("popup", "", $i)
    sleep(10)
    until $i = 0
    GUIDelete($gui)
EndFunc

Func tray_side($title, $text, $sound)
    Opt("GUICoordMode", 0)
    if FileExists(@ScriptDir & "\data\tray.wma") = True Then
    if $sound = 1 then SoundPlay(@ScriptDir & "\data\tray.wma", 0)
    endif
    $i = 950
        $gui = GUICreate("popup", 200, 70, 850, 650, BitOR($WS_POPUPWINDOW, $WS_THICKFRAME), BitOR($WS_EX_CLIENTEDGE, $WS_EX_TOOLWINDOW))
        GUISetState(@SW_SHOW)
        ConsoleWrite($i & @CRLF)
    GUISetBkColor(0xE0FFFF)
    WinSetTrans("popup", "", 230)
    $rgn = _WinAPI_CreateRoundRectRgn(6, 6, 200, 70, 60, 40)
    _WinAPI_SetWindowRgn($gui, $rgn)
    GUISetFont(9, 800, 4)
    GUICtrlCreateLabel($title, 10, 7, 190, 20)
    GUISetFont(7, 600, 0)
    GUICtrlCreateLabel($text, 5, 23, 190, 40)
    Do
        $i = $i - 1
        _WinAPI_SetWindowPos($gui, "", $i, 650, 200, 70, $SWP_SHOWWINDOW)
        sleep(10)
    until $i = 850
    sleep(5000)
    Do
        $i = $i + 1
        _WinAPI_SetWindowPos($gui, "", $i, 650, 200, 70, $SWP_SHOWWINDOW)
        sleep(10)
    until $i = 900
    GUIDelete($gui)
EndFunc
Func tray_sidefunc($title, $text, $sound)
    $dll = DllOpen("user32.dll")
    Opt("GUICoordMode", 0)
    if FileExists(@ScriptDir & "\data\tray.wma") = True then
    if $sound = 1 then SoundPlay(@ScriptDir & "\data\tray.wma", 0)
    endif
    $i = 0
        $gui = GUICreate("popup", 200, 70, 850, 650, BitOR($WS_POPUPWINDOW, $WS_THICKFRAME), BitOR($WS_EX_CLIENTEDGE, $WS_EX_TOOLWINDOW))
        GUISetState(@SW_SHOW)
        ConsoleWrite($i & @CRLF)
    GUISetBkColor(0xE0FFFF)
    WinSetTrans("popup", "", 230)
    $rgn = _WinAPI_CreateRoundRectRgn(6, 6, 200, 70, 60, 40)
    _WinAPI_SetWindowRgn($gui, $rgn)
    GUISetFont(9, 800, 4)
    GUICtrlCreateLabel($title, 10, 7, 190, 20)
    GUISetFont(7, 600, 0)
    GUICtrlCreateLabel($text, 5, 23, 190, 40)
    $i = 900
    Do
        $i = $i - 1
        _WinAPI_SetWindowPos($gui, "", $i, 650, 200, 70, $SWP_SHOWWINDOW)
        sleep(10)
    until $i = 850
    $n = 0
    Do
    sleep(10)
    $n = $n + 1
    $pos = MouseGetPos()
    if $pos[0] > 850 and $pos[1] > 650 then
    if _IsPressed("01", $dll) = True Then
    GUIDelete($gui)
    mouseclickfunc()
    ExitLoop
    EndIf
    endif
    Until $n = 500
    Do
        $i = $i + 1
        _WinAPI_SetWindowPos($gui, "", $i, 650, 200, 70, $SWP_SHOWWINDOW)
        sleep(10)
    until $i = 900
    GUIDelete($gui)
EndFunc

i suggest you download the data pack. it contains the sound :P

zibit,

data.rar

Edited by Zibit

Share this post


Link to post
Share on other sites
wakillon

Hi Zibit ! :P

If i try

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <TrayFunc.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 0)

Tray_func ( "Tray Popup GUI UDF", "Hi Zibit it work's!", 1 )

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
GUIDelete()

Func MouseClickFunc()
    ConsoleWrite("works" & @CRLF)
    exit
EndFunc

I heard no sound cause soundplay support wav and mp3, not wma !

And title is cut... :mellow:

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×