Keene Coder Posted May 21, 2005 Posted May 21, 2005 How do I minimize a window to the system tray (area by clock)? I want to have an AutoIt script sit in the system tray & when a hotkey or menu item is pressed it will minimize the currently active window to the system tray. Is this possible in AutoIt? Regards Brian Keene [FONT=Arial][SIZE=1][COLOR=yellow][B]When my kids were young this encounter really happened:Dad says: "Quit it kids! Your driving me CRAZY!Kid1 says: "Wheres crazy?"Kid2 says: "Can I go to crazy with you?"
zeroZshadow Posted May 21, 2005 Posted May 21, 2005 u could try to make it just hide, and set a show command on clicking the trayicon *If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Keene Coder Posted May 21, 2005 Author Posted May 21, 2005 True, but I'm hoping to be able to put multiple windows into the SysTray. So this wouldn't work. Also, I would like to have an icon in the SysTray for the program/window, not just for my script. Good suggestion though. Regards Brian Keene [FONT=Arial][SIZE=1][COLOR=yellow][B]When my kids were young this encounter really happened:Dad says: "Quit it kids! Your driving me CRAZY!Kid1 says: "Wheres crazy?"Kid2 says: "Can I go to crazy with you?"
LxP Posted July 30, 2005 Posted July 30, 2005 So has the outlook for this functionality improved yet? I know that someone has worked on functionality to remove/restore icons from/to the system tray, so is it likely that it could be slightly further extended perhaps to minimise multiple non-AutoIt windows to the tray? Obviously the biggest problem with this is that if the script quits without 'restoring' the windows then the windows remain hidden, but that shouldn't be a fatal problem.
layer Posted July 30, 2005 Posted July 30, 2005 You need the latest BETA to minimize to tray. FootbaG
LxP Posted July 30, 2005 Posted July 30, 2005 (edited) Oh! I didn't realise that it was already doable with AutoIt's native functions. Could you please post some code demonstrating how to minimise a Notepad window to the tray? (Edit: because there are no obvious functions in the help file index that suggest the behaviour.) Edited July 30, 2005 by LxP
buzz44 Posted July 31, 2005 Posted July 31, 2005 WinSetState("Notepad window title", "", @SW_MINIMIZE) qq
JoeCool Posted July 31, 2005 Posted July 31, 2005 :-)http://www.autoitscript.com/forum/index.php?showtopic=14031
LxP Posted July 31, 2005 Posted July 31, 2005 Thanks for the responses guys, but these aren't quite what I'm after (a method to minimise a non-AutoIt window to the tray).WinSetState("Notepad window title", "", @SW_MINIMIZE)only minimises Notepad to the taskbar, while this thread demonstrates how to minimise an AutoIt-built GUI to the tray (which is quite handy anyway, JoeCool!).Any other ideas?
buzz44 Posted July 31, 2005 Posted July 31, 2005 You can't minimize a notepad window to the tray, it doesn't have an icon... But I think for windows like NAV you just close the window and it minimizes. qq
LxP Posted July 31, 2005 Posted July 31, 2005 You can't minimize a notepad window to the tray, it doesn't have an icon...In theory it would be possible for AutoIt (and any other program) to minimise any window it likes to a system tray icon if it follows these steps:Note the icon used by the window.Hide the window.Create a new icon in the tray with the icon noted before.Set the icon so that a left-click shows the window and destroys the icon.Optionally attach a right-click menu of Restore, Maximise and Close to the icon.Many programs (including PowerPro and The Wonderful Icon) adopt this approach to give the user the possibility of minimising any window they like to the tray.As stated somewhere above, an AutoIt script could do this for one window at a time because it can only manipulate one tray icon (its own).
buzz44 Posted July 31, 2005 Posted July 31, 2005 I thought you meant without external forces. You can't minimize your notepad window to the tray manually can you? qq
Lazycat Posted July 31, 2005 Posted July 31, 2005 I use PowerPro with the right muse button click on the minimize button. Just an idea (probably lame) how it can be done with autoit: create one host script, that will be do main work and simple tray based script, that will accept params from commandline. When you do something (right mouse click, hotkey etc) in the main script for minimize for example active window, main script take window handle, file name and start instance of second script with this parameters. When second script run, it's hide window and create systray element with icon from file name, given in commandline. Not tried at all, but I guess this can work. Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s])
LxP Posted July 31, 2005 Posted July 31, 2005 (edited) I thought you meant without external forces. You can't minimize your notepad window to the tray manually can you?<{POST_SNAPBACK}>No; there's no standard Windows-certified way of doing this.Programs that implement this functionality for themselves simply hide their window and set their tray icon to show the window again, while programs that operate on 'foreign' windows do so in the fashion that I described above. Edited July 31, 2005 by LxP
LxP Posted July 31, 2005 Posted July 31, 2005 Not tried at all, but I guess this can work.That's a very interesting idea, Lazycat. It would work but the downside of it is that for each tray-minimised program, another AutoIt process would be required. On my system a one-line script consisting of a MsgBox() takes up 4½MB of memory.This will definitely suit my purposes until a single-process solution arises though. Thanks again!
Lazycat Posted July 31, 2005 Posted July 31, 2005 It would work but the downside of it is that for each tray-minimised program, another AutoIt process would be required. On my system a one-line script consisting of a MsgBox() takes up 4½MB of memory.<{POST_SNAPBACK}>Yes, you right, this is really downside that each minimized window should have own process... But from other side, biggest part of this size - shared libraries, so each identical additional process should take only about 160 kb - autoit stub size. Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s])
buzz44 Posted July 31, 2005 Posted July 31, 2005 (edited) Why can't you just have one script, one icon, one instance of AutoIt that controls all windows? Why can't they all minimize to the same AutoIt tray icon. Edited July 31, 2005 by Burrup qq
LxP Posted July 31, 2005 Posted July 31, 2005 (edited) Doable but not as intuitive an approach. For instance, if you see Firefox and Cygwin icons in your tray then you pretty much know that Firefox and Cygwin are in memory.Edit: this would be an interesting idea for the Scripts and Scraps forum nonetheless, and most likely a useful utility for quite a few people! Someone should program it! Edited July 31, 2005 by LxP
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