stuka Posted September 18, 2007 Share Posted September 18, 2007 (edited) . Edited August 21, 2009 by stuka Link to comment Share on other sites More sharing options...
sandin Posted September 18, 2007 Share Posted September 18, 2007 just use: GUICtrlSetState($tray_var, $GUI_DISABLE) and: GUICtrlSetState($tray_var, $GUI_ENABLE) to gray it, and make it active again. (note: you must have: #include <GUIConstants.au3> in the beguining of the script for $gui_enable/disable to work) Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
Kip Posted September 18, 2007 Share Posted September 18, 2007 well, why dont you try it, huh? MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
sandin Posted September 18, 2007 Share Posted September 18, 2007 sry, I made a mistake about command ;p the right command was: TrayItemSetState($Notepad_focus, $GUI_DISABLE) here's an example: expandcollapse popup#include <Constants.au3> #include <GUIConstants.au3> #NoTrayIcon Opt("TrayOnEventMode",1) Opt("TrayMenuMode",1) Opt("WinTitleMatchMode", 2) $Notepad_focus = TrayCreateItem("Focus Notepad") TrayItemSetOnEvent(-1,"FocusNotepad") TrayCreateItem("") $exit = TrayCreateItem("Exit") TrayItemSetOnEvent(-1,"ExitEvent") TraySetState() AdlibEnable("adlib1", 10) func adlib1() If Not ProcessExists("Notepad.exe") Then TrayItemSetState($Notepad_focus, $GUI_DISABLE) Else TrayItemSetState($Notepad_focus, $GUI_ENABLE) EndIf EndFunc While 1 Sleep(10) ; Idle loop WEnd Exit Func ExitEvent() Exit EndFunc Func FocusNotepad () WinActivate("Notepad", "") EndFunc Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
Slaiochi Posted September 18, 2007 Share Posted September 18, 2007 That example contradicts itself, when you right click the tray icon Notepad loses focus and the option never gets "greyed out". Link to comment Share on other sites More sharing options...
sandin Posted September 18, 2007 Share Posted September 18, 2007 this example works perfectly for me, if the notepad exist, the option in tray menu will be clickable, if the notepad process doesn't exist, the tray menu option will be "grayed out" (not clickable). And if you click on the "focus notepad" option in tray menu, you will set notepad as active window. Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
sandin Posted September 18, 2007 Share Posted September 18, 2007 Try this: expandcollapse popup#include <Constants.au3> #include <GUIConstants.au3> #NoTrayIcon TraySetClick (16) Opt("TrayMenuMode",1) $a = "Title" ; about label $name = TrayCreateItem ("About") ; help label $help = TrayCreateItem ("Help!") ; hotkeys label $hotkeys = TrayCreateItem ("Keyboard Hotkeys") ; divider TrayCreateItem ("") ; start label $StartItem = TrayCreateItem ("Start") ; stop label $StopItem = TrayCreateItem ("Stop") ; pause label $PauseItem = TrayCreateItem ("Pause/Unpause") ; divider TrayCreateItem ("") ; remove startup entry label $addrun = TrayCreateItem ("Add Billy To System Startup") ; remove startup entry label $remrun = TrayCreateItem ("Remove Billy From System Startup") ; divider TrayCreateItem ("") ; exit label $exit = TrayCreateItem ("Exit") ; show tray icon TraySetState () ; tool start tray tip TrayTip ($a, "Right click to start...", 1, 1) ; -------------------- tray menu label end ------------------- ; ----------------- tray menu function start ----------------- AdlibEnable("adlib1", 10) func adlib1() If Not ProcessExists("Billy.exe") Then TrayItemSetState($StopItem, $GUI_DISABLE) Else TrayItemSetState($StopItem, $GUI_ENABLE) EndIf EndFunc ; begin loop While 1 $msg = TrayGetMsg () Select Case $msg = 0 ContinueLoop ; ----- info label----- ; info msg box Case $msg = $name MsgBox (64, "Autorun Eater 1.0", "yadayada.") ; ----- help label----- ; help option Case $msg = $help If FileExists ("C:\Program Files\Mozilla Firefox\firefox.exe") Then Run (@ComSpec & ' /c start firefox.exe "C:\Program Files\Autorun Eater Temp\help.html" ', "", @SW_HIDE) Else ShellExecute ("iexplore.exe", "C:\Program Files\Autorun Eater Temp\help.html") EndIf ; ----- hotkey label----- ; hotkeys traytip Case $msg = $hotkeys TrayTip ("Keyboard Hotkeys", "Pause = pause tool", 1 , 1) ; ----- start label----- ; start Billy option Case $msg = $StartItem ;start Billy sound If Not ProcessExists("Billy.exe") Then SoundPlay ("C:\Program Files\Autorun Eater Temp\goat.wav", 1) EndIf ; start Billy If Not ProcessExists("Billy.exe") Then ShellExecute ("C:\Program Files\Autorun Eater Temp\Billy.exe") EndIf ; scan started traytip If ProcessExists("Billy.exe") Then TrayTip ("Tool Status", "Scan Started", 1 , 1) Else TrayTip ("Tool Status", "Cannot Start Duplicate Processes!", 1 , 1) EndIf ; ----- stop label----- ; stop Billy option Case $msg = $StopItem ; stop Billy sound If ProcessExists("Billy.exe") Then SoundPlay ("C:\Program Files\Autorun Eater Temp\goat.wav", 1) EndIf ; scan stopped traytip If ProcessExists("Billy.exe") Then TrayTip ("Tool Status", "Scan Stopped", 1 , 1) EndIf ; stop Billy ProcessClose ("Billy.exe") If Not ProcessExists("Billy.exe") Then TrayTip ("Tool Status", "No Process To Stop", 1 , 1) EndIf Case $msg = $exit ExitLoop EndSelect WEnd Exit Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now