Sign in to follow this  
Followers 0
Erik.

little problem whit script:

4 posts in this topic

Hi

i made this:

#include <Guiconstants.au3>


Hotkeyset("\","popup")

Guictrlcreategroup("",-99,-99,1,1)
$menu = GUicreate("private Program", 1010,44,0,0)
$group1 = Guictrlcreategroup("",0,0,1010,41)
$zonealarm = Guictrlcreatebutton("Zone alarm aan",8,8,49,25)
Guictrlsetstate(-1,$gui_DISABLE)
$xfire1 = Guictrlcreatebutton("X-fire aan",64,8,49,25)
$xfire2 = Guictrlcreatebutton("X-fire uit",200,8,49,25)
$ts1 = Guictrlcreatebutton("TeamSpeak aan",300,8,49,25)
$ts2 = Guictrlcreatebutton("TeamSpeak uit",400,8,49,25)

Guisetstate(@SW_HIDE)
func popup()
    $state = Guictrlgetstate($zonealarm)
    If $state = 144 Then
        Guictrlsetstate($zonealarm,$Gui_ENABLE)
        Guisetstate(@sw_show)
        elseif $state = 80 Then
        Guictrlsetstate($zonealarm ,$gui_DISABLE)
        Guisetstate(@SW_HIDE)
    EndIf
endfunc 
    Do
    $msg = Guigetmsg()
    Select
        
    Case $msg = $xfire1
        
    Guictrlsetstate($zonealarm,$gui_DISABLE)
        Guisetstate(@SW_HIDE)
        If ProcessExists("XFire.exe") Then
            MsgBox(64,"X-Fire","X-Fire staat al aan")
        ElseIf  Not ProcessExists("xFire.exe") Then
            Run("D:\Program Files\xfire\xfire.exe")
            if WinWaitActive("XFire") Then
            MsgBox(64,"X-Fire","X-Fire staat aan")
            ElseIf Not WinWaitActive("XFire") Then
            MsgBox(64,"X-Fire","X-Fire staat niet aan")
        EndIf
            EndIf
Guisetstate(@SW_SHOW)
Guictrlsetstate($zonealarm,$Gui_ENABLE)


Case $msg = $xfire2
    
    Guictrlsetstate($zonealarm,$gui_DISABLE)
        Guisetstate(@SW_HIDE)
        ProcessClose("XFire.exe")
        WinWaitClose("XFire")
        If Not ProcessExists("Xfire.exe") Then
            MsgBox(64,"X-Fire","X-Fire met succes gesloten")
        EndIf
            
Guisetstate(@SW_SHOW)
Guictrlsetstate($zonealarm,$Gui_ENABLE)

Case $msg = $zonealarm
    
        Guictrlsetstate($zonealarm,$gui_DISABLE)
        Guisetstate(@SW_HIDE)
        If ProcessExists("zlclient.exe") Then
            MsgBox(64,"Zone Alarm","Zone Alarm staat al aan")
        ElseIf  Not ProcessExists("zlclient.exe") Then
            msgbox(64,"Zone alarm","Zone Alarm staat niet aan!!")
            Run("C:\Program Files\Zone Labs\ZoneAlarm\zlclient.exe")
            if WinWaitActive("ZoneAlarm Security Suite") Then
            MsgBox(64,"Zone Alarm","Zone Alarm staat weer aan")
            ElseIf Not WinWaitActive("ZoneAlarm Security Suite") Then
            MsgBox(64,"Zone Alarm","Zone Alarm staat niet aan!!!")
        EndIf
            EndIf
        Guisetstate(@SW_SHOW)
Guictrlsetstate($zonealarm,$Gui_ENABLE)

Case $msg = $ts1
    
    Guictrlsetstate($zonealarm,$gui_DISABLE)
        Guisetstate(@SW_HIDE)
        If ProcessExists("TeamSpeak.exe") Then
            MsgBox(64,"TeamSpeak","TeamSpeak staat al aan")
        ElseIf  Not ProcessExists("TeamSpea.exe") Then
            Run("D:\Program Files\Teamspeak2_RC2\TeamSpeak.exe")
            if WinWaitActive("TeamSpeak 2") Then
            MsgBox(64,"TeamSpeak","TeamSpeak staat aan")
            ElseIf Not WinWaitActive("TeamSpeak.exe") Then
            MsgBox(64,"TeamSpeak","TeamSpeak staat niet aan")
        EndIf
            EndIf
Guisetstate(@SW_SHOW)
Guictrlsetstate($zonealarm,$Gui_ENABLE)

Case $msg = $ts2
    
    Guictrlsetstate($zonealarm,$gui_DISABLE)
        Guisetstate(@SW_HIDE)
        ProcessClose("TeamSpeak.exe")
        WinWaitClose("TeamSpeak 2")
        If Not ProcessExists("TeamSpeak.exe") Then
            MsgBox(64,"TeamSpeak","TeamSpeak met succes gesloten")
        EndIf
            
Guisetstate(@SW_SHOW)
Guictrlsetstate($zonealarm,$Gui_ENABLE)


   



    endselect

until $msg = $GUI_EVENT_CLOSE

now do i want to add this:

#Include <Constants.au3>
#NoTrayIcon

Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown.

$settingsitem   = TrayCreateMenu("Settings")
$displayitem    = TrayCreateItem("Display", $settingsitem)
$printeritem    = TrayCreateItem("Printer", $settingsitem)
TrayCreateItem("")
$aboutitem    = TrayCreateItem("About")
TrayCreateItem("")
$exititem      = TrayCreateItem("Exit")

TraySetState()

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = 0
            ContinueLoop
        Case $msg = $aboutitem
            Msgbox(64,"About:","AutoIt3-Tray-sample")
        Case $msg = $exititem
            ExitLoop
    EndSelect
WEnd

Exit

but when i add that my script does not work any more

can someone help me?

i want to add a tray menu and submenu's


I little problem, hard to find and fix

Share this post


Link to post
Share on other sites



Try something like this:

#include-once
#NoTrayIcon

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.

TrayCreateItem("Settings")
TrayItemSetOnEvent(-1,"Settings")
TrayCreateItem("Display")
TrayItemSetOnEvent(-1,"Display")
TrayCreateItem("Printer")
TrayItemSetOnEvent(-1,"Printer")
TrayCreateItem("")
TrayCreateItem("About")
TrayItemSetOnEvent(-1,"About")
TrayCreateItem("")
TrayCreateItem("Exit")
TrayItemSetOnEvent(-1,"ExitScript")

TraySetState()

Func Settings ()
 ;input commands to execute if Settings is clicked
EndFunc

Func Display ()
 ;input commands to execute if Display is clicked
EndFunc

Func Printer ()
 ;input commands to execute if Printer is clicked
EndFunc

Func About ()
 ;input commands to execute if About is clicked
EndFunc

Func ExitScript ()
 Exit
EndFunc

Nomad :D


Share this post


Link to post
Share on other sites

Try something like this:

#include-once
#NoTrayIcon

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.

TrayCreateItem("Settings")
TrayItemSetOnEvent(-1,"Settings")
TrayCreateItem("Display")
TrayItemSetOnEvent(-1,"Display")
TrayCreateItem("Printer")
TrayItemSetOnEvent(-1,"Printer")
TrayCreateItem("")
TrayCreateItem("About")
TrayItemSetOnEvent(-1,"About")
TrayCreateItem("")
TrayCreateItem("Exit")
TrayItemSetOnEvent(-1,"ExitScript")

TraySetState()

Func Settings ()
 ;input commands to execute if Settings is clicked
EndFunc

Func Display ()
 ;input commands to execute if Display is clicked
EndFunc

Func Printer ()
 ;input commands to execute if Printer is clicked
EndFunc

Func About ()
 ;input commands to execute if About is clicked
EndFunc

Func ExitScript ()
 Exit
EndFunc

Nomad :D

Thanks for that now i can go on:P

I little problem, hard to find and fix

Share this post


Link to post
Share on other sites

No problem. Glad it worked out for you. :D


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