MrChris Posted August 22, 2006 Share Posted August 22, 2006 I am trying to make a little tray icon that will allow me to hide/show firefox.exe but it does not seem to be working really and am not sure what I may be missing. Bottom line is if I hit the Hide option in the tray it does not make the Firefox windows invisiable yet the title of my Firefox does contain the word "firefox" expandcollapse popup#Include <Constants.au3> #NoTrayIcon Global $FirefoxPath Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown. Opt("WinTitleMatchMode", 4) $OpenFirefox = TrayCreateItem("Open Firefox") $CloseFirefox = TrayCreateItem("Close Firefox") TrayCreateItem("") $HideFirefox = TrayCreateItem("Hide Firefox") $ShowFireFox = TrayCreateItem("Show Firefox") TrayCreateItem("") $About = TrayCreateItem("About") TrayCreateItem("") $Exit = TrayCreateItem("Exit") TraySetState() While 1 $msg = TrayGetMsg() Select ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Case $msg = 0 ContinueLoop ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Case $msg = $About Msgbox(64,"About","Firefox Tray Menu") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Case $msg = $Exit ExitLoop ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Case $msg = $HideFirefox ;WinActivate("Firefox", "") WinSetState("Firefox", "", @SW_HIDE) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Case $msg = $ShowFirefox ;WinActivate("Firefox", "") WinSetState("Firefox", "", @SW_SHOW) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Case $msg = $CloseFirefox RunWait("TASKKILL /IM FIREFOX.EXE") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Case $msg = $OpenFirefox Run(@ScriptDir & "\PortableFirefox.exe") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; EndSelect WEnd Exit Link to comment Share on other sites More sharing options...
MHz Posted August 22, 2006 Share Posted August 22, 2006 Since you are using WinTitleMatchMode 4, then try using the classname instead. You may find the the title Firefox... is being used also by an invisible window. Link to comment Share on other sites More sharing options...
Alan Robertson Posted August 22, 2006 Share Posted August 22, 2006 (edited) Opt("WinTitleMatchMode", 4)If you change the above to 2 then it works.Nice wee script btw Edit: Also, if you want to have the Firefox icon in the task bar instead of the AutoIT one then add this line before the TraySetState() line -TraySetIcon ("C:\Program Files\Mozilla Firefox\firefox.exe") ; Or whatever the location of your Firefox install Edited August 22, 2006 by Alan Robertson Link to comment Share on other sites More sharing options...
MrChris Posted August 22, 2006 Author Share Posted August 22, 2006 Well the prupose of this little trayicon is. I use PortableFirefox but one small problem I have is that since I have a crap load of extenstions installed Firefox often takes FOREVER to Open up. So I was thinking of just making a little systray app that when run @ windows startup will Launch PortableFirefox Hidden and I can just click the option to Show Firefox. Now that the GUI is kinda working the only left over problem I have is. Since PortableFirefox is just a launcher for firefox.exe how can I launch portablefirefox.exe and have the firefox.exe window still be hidden? Make sense? Regards, MrChris Link to comment Share on other sites More sharing options...
xcal Posted August 22, 2006 Share Posted August 22, 2006 (edited) This works for me. I don't have portable firefox, so I can't test with that. But with regular, it does what it should. You'll have to change the $FirefoxPath and possibly the "classname=MozillaUIWindowClass" if portable uses a different classname. expandcollapse popup#Include <Constants.au3> Opt("TrayMenuMode",1) Opt("WinTitleMatchMode", 4) $FirefoxPath = "C:\Program Files\Mozilla Firefox\firefox.exe" Run($FirefoxPath, "", @SW_HIDE) $OpenFirefox = TrayCreateItem("Open Firefox") $CloseFirefox = TrayCreateItem("Close Firefox") TrayCreateItem("") $HideFirefox = TrayCreateItem("Hide Firefox") $ShowFireFox = TrayCreateItem("Show Firefox") TrayCreateItem("") $About = TrayCreateItem("About") TrayCreateItem("") $Exit = TrayCreateItem("Exit") While 1 $msg = TrayGetMsg() Select Case $msg = $About Msgbox(64,"About","Firefox Tray Menu") Case $msg = $Exit ExitLoop Case $msg = $HideFirefox WinSetState("classname=MozillaUIWindowClass", "", @SW_HIDE) Case $msg = $ShowFirefox WinSetState("classname=MozillaUIWindowClass", "", @SW_SHOW) Case $msg = $CloseFirefox RunWait("TASKKILL /IM FIREFOX.EXE", "", @SW_HIDE) Case $msg = $OpenFirefox Run($FirefoxPath) EndSelect WEnd Exit Edited August 22, 2006 by xcal How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
MrChris Posted August 22, 2006 Author Share Posted August 22, 2006 Thanks for the reply, Yes If I do not use PortableFirefox it works just fine. But since portableFirefox.exe calls firefox.exe Im not sure how I can run("portablefirefox.exe") and still have it hide firefox.exe. MrChris Link to comment Share on other sites More sharing options...
xcal Posted August 22, 2006 Share Posted August 22, 2006 After the 'run' you could try... WinWait("classname=MozillaUIWindowClass") WinSetState("classname=MozillaUIWindowClass", "", @SW_HIDE) But you'll see it flicker on screen before hiding. How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
MrChris Posted August 22, 2006 Author Share Posted August 22, 2006 Thanks for the reply but thats what I tried with no luck. 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