Sign in to follow this  
Followers 0
slightly_abnormal

send to tray button..

3 posts in this topic

I need a little assistance in making a send to tray button, one that will send its self to a tray and one that will send a preffered program to tray.. okay, I have beta 1.10, im using it only so i can use trayicon.. i could use something else besides opera, but i'm just trying to learn :o

#include <GUIConstants.au3>
#NoTrayIcon
Opt("RunErrorsFatal", 0)
Global $Paused, $toggle_hide = 1, $toggle_min = 1, $hide_flag = @SW_HIDE, $min_flag = @SW_MINIMIZE
HotKeySet("{ESC}", "Terminate")

#cs
TraySetState()
TraySetToolTip("This is my new tooltip text!")
Opt("TrayOnEventMode",1)
Opt("TrayMenuMode",1); Default tray menu items (Script Paused/Exit) will not be shown.
TraySetClick(16); Only secondary mouse button will show the tray menu.
$infoitem = TrayCreateItem("Info")
TrayItemSetOnEvent(-1,"ShowInfo")
TrayCreateItem("")
$exititem = TrayCreateItem("Exit")
TrayItemSetOnEvent(-1,"ExitScript")
TraySetState()
#ce

GUICreate("Control 0pera", 280, 120, -1, -1, -1, $WS_EX_TOPMOST)
;== Small label ==;
$Group_1 = GUICtrlCreateGroup("Control Opera", 10, 10, 260, 100)
GUICtrlSetFont(-1, 9, 400, 0, "georgia")
;Hide Opera
$Button1 = GUICtrlCreateButton("Hide/Show Opera", 30, 30, 110, 30)
GUICtrlSetFont(-1, 9, 400, 0, "georgia")
;Show Opera
$Button2 = GUICtrlCreateButton("Min/Res Opera", 140, 30, 110, 30)
GUICtrlSetFont(-1, 9, 400, 0, "georgia")
;send to tray
$Button3 = GUICtrlCreateButton("Opera to tray", 30, 60, 110, 30)
GUICtrlSetFont(-1, 9, 400, 0, "georgia")
;Hide window
$Button4 = GUICtrlCreateButton("Min to tray", 140, 60, 110, 30)
GUICtrlSetFont(-1, 9, 400, 0, "georgia")
Opt("WinTitleMatchMode", 2)
$win_title = "Opera"

;Tray



GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop

            
       ;Hide/Show
       ;==========================>
        Case $msg = $Button1
       ; hide the windows
            $wlist = WinList($win_title)
            If $toggle_hide Then
                $hide_flag = @SW_HIDE
            Else
                $hide_flag = @SW_SHOW
            EndIf
            For $x = 1 To $wlist[0][0]
                WinSetState($wlist[$x][0], '', $hide_flag)
                
            Next
            $toggle_hide = Not $toggle_hide
            
            
       ;Minimize/Restore
       ;==========================>
        Case $msg = $Button2
            
       ; show the windows
            $wlist = WinList($win_title)
            If $toggle_min Then
                $min_flag = @SW_MINIMIZE
            Else
                $min_flag = @SW_RESTORE
            EndIf
            For $x = 1 To $wlist[0][0]
                WinSetState($wlist[$x][0], '', $min_flag)
            Next
            $toggle_min = Not $toggle_min
            
             ;Minimize Opera to tray
       ;==========================>
        Case $msg = $Button3
            

     
            
                 ;Minimize Control to tray
       ;==========================>
        Case $msg = $Button4
            

   
    EndSelect
WEnd

Func ExitScript()
    Exit
EndFunc

Func Terminate()
    Exit 0
EndFunc ;==>Terminate

#cs
Func ShowInfo()
    if ProcessExists("Opera.exe") Then
    WinActivate("Opera")
else
        EndFunc
    
#ce

Share this post


Link to post
Share on other sites



Hi

I have the same question,but it seems the current AUTOIT 3 can't do this job,you should install a Beta Autoit to solve this problem.

Share this post


Link to post
Share on other sites

okay, I have beta 1.10, im using it only so i can use trayicon..

kmps, you should read that he has beta. ;-)

Ooo Ëxçã¿îbúr ooO"Information Is Not Knowledge." ~Albert Einstein

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  
Followers 0