Sign in to follow this  
Followers 0
Cha0sBG

Need Help With Tray Menu

5 posts in this topic

Hello All AutoIt Scripters :D i tryed to add a TrayMenu but everytime an error :) or buttons don't work can someone help me

#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>

Dim $csvFile = @ScriptDir & "\Data\Path.ini"

Opt("TrayMenuMode",1)
Local $Window = WinGetHandle("[CLASS:CLIENT]")
WinSetTitle($Window, "", "SRO_Client")
Global $Window = WinGetHandle("SRO_Client")

$destination = "Logos\Good.gif"
SplashImageOn("Easy Mod v2.5", $destination,326,207)
Sleep(3000)
SplashOff()
$Main = GuiCreate("Easy MoD v2.5", 370, 260, 236, 179)
GuiCtrlCreateTab(0, 0, 417, 417)
$MainTab = GuiCtrlCreateTabItem("Main")
GUIStartGroup()
$MinMoD = GUICtrlCreateButton("Minimize MoD", 290, 33,80)
$HideM0D = GUICtrlCreateButton("Hide This MoD", 290, 61, 80)
GuiCtrlCreateGroup("", 5, 25, 280, 35)
$min = GuiCtrlCreateButton("Minimize", 10, 33, 80)
$max = GuiCtrlCreateButton("Maximize", 106, 33, 80)
$hide = GuiCtrlCreateButton("Hide", 201, 33, 80)
GUIStartGroup()
GuiCtrlCreateGroup("", 5, 52, 280, 35)
$show = GuiCtrlCreateButton("Show", 10, 61, 80)
$RunSro = GUICtrlCreateButton("RunSro", 106,61, 80) 
$RunLoader = GuiCtrlCreateButton("RunLoader", 201, 61, 80)
GUIStartGroup()
GuiCtrlCreateGroup ("", 5, 82, 280, 35)
$Disable = GuiCtrlCreateButton("Disable", 10, 90, 80)
$Enable = GuiCtrlCreateButton("Enable", 106, 90, 80)
$kill = GuiCtrlCreateButton("Kill", 201, 90, 80)
$Group2 = GUICtrlCreateGroup("Select Your Default Silkroad Directory", 5, 135, 350, 100)
$SroPath = GUICtrlCreateInput("", 10, 150, 217, 22)
$Browse = GUICtrlCreateButton("Browse", 250, 150, 99, 25, 0)
$savesettings = GUICtrlCreateButton("Save Settings", 250, 180, 99, 25, 0)
GuiCtrlCreateTabItem("About")
GUIStartGroup()
GuiCtrlCreateGroup("About", 5, 25, 280, 90)
GuiCtrlCreateLabel("Version: 2.4", 10, 40)
GuiCtrlCreateLabel("Made by: Cha0sBG And X2000", 10, 55)
GuiCtrlCreateLabel("Made for: ", 10, 75)
$SilkroadTrader = GuiCtrlCreateLabel("Extreme Hackers.Pro-Forums.com", 70, 75)
GuiCtrlSetColor($SilkroadTrader, 330000)
GUISetState(@SW_SHOW)

$Iniread = IniRead($csvFile, "SilkroadSettings", "SilkroadPath", "Please Enter Your Silkroad Path")
$dizinayar = GUICtrlSetData($SroPath, $Iniread)

While 1
    $msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        
Switch $msg     
        Case $Browse
            $sropathchange = FileSelectFolder("Select Silkroad Directory", "")
            GUICtrlSetData($SroPath, $sropathchange & "\")

Case $savesettings
            $IniWrite = GUICtrlRead($SroPath)
            IniWrite($csvFile, "SilkroadSettings", "SilkroadPath", $IniWrite)
    
Case $HideM0D
    HideM0D()

Case $MinMoD
    MinMoD()

Case $kill
    kill()

Case $min 
    minsro()

Case $max 
    maxsro()

Case $hide 
    hidesro()

Case $show
    showsro()

Case $RunSro
    runsro()

Case $RunLoader
    RunLoader()

Case $Disable
    DisableSro()

Case $Enable 
    EnableSro()

EndSwitch
WEnd

Func HideM0D()
    WinSetState("Easy MoD v2.5", "", @SW_Hide)
    EndFunc

Func minsro()
    WinSetState("SRO_Client","",@SW_MINIMIZE)
EndFunc

Func maxsro()
    WinSetState("SRO_Client","",@SW_MAXIMIZE)
EndFunc

Func hidesro()
    WinSetState("SRO_Client","",@SW_HIDE)
EndFunc

Func showsro()
    WinSetState("SRO_Client","",@SW_SHOW)
EndFunc

Func Disablesro()
    WinSetState("SRO_Client","",@SW_DISABLE)
EndFunc

Func EnableSro()
    WinSetState("SRO_Client","",@SW_ENABLE)
EndFunc

Func runsro()
Local $sropath2
    $sropath2 = GUICtrlRead($SroPath)
        ShellExecute("Silkroad.exe", "", $sropath2, "")
EndFunc

Func RunLoader() 
    Local $sropath2
    $sropath2 = GUICtrlRead($SroPath)
       ShellExecute("Loader.exe", "", $sropath2, "")
EndFunc

Func MinMoD()
    WinSetState("Easy MoD v2.5","",@SW_Minimize)
EndFunc

ok this is my code if someone can add tray menu :D i will be grateful

Reguards:

~Cha0sBG


Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Sample for minize to tray: here

Sample for tray menu items from helpfile:

#Include <Constants.au3>
#NoTrayIcon

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

$prefsitem  = TrayCreateItem("Preferences")
TrayCreateItem("")
$aboutitem  = TrayCreateItem("About")
TrayCreateItem("")
$exititem   = TrayCreateItem("Exit")

TraySetState()

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = 0
            ContinueLoop
        Case $msg = $prefsitem
            Msgbox(64, "Preferences:", "OS:" & @OSVersion)
        Case $msg = $aboutitem
            Msgbox(64, "about:", "AutoIt3-Tray-sample.")
        Case $msg = $exititem
            ExitLoop
    EndSelect
WEnd

Exit
Edited by Zedna

Share this post


Link to post
Share on other sites

dude i have tryed those and allways errors :D can you include them in my script ? thanks


Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread.

Share this post


Link to post
Share on other sites

You're missing a very important part:

Case $msg = 0
            ContinueLoop

This is what $msg will be about 99% of the time.

Share this post


Link to post
Share on other sites

i have added that too but ... nothing :S can someone just add it to my script so i can see how to do it next time ? please


Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread.

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