jftuga Posted April 29, 2010 Posted April 29, 2010 (edited) I searched the forums but didn't seem to find exactly what I was looking for. Is it possible to write an AutoIt script to make a 3rd-party application (no source, .exe only) minimuze to the system tray (next to the clock) instead of the taskbar? Thanks, -John Edited April 29, 2010 by jftuga Admin_Popup, show computer info or launch shellRemote Manager, facilitates connecting to RDP / VNCProc_Watch, reprioritize cpu intensive processesUDF: _ini_to_dict, transforms ini file entries into variablesUDF: monitor_resolutions, returns resolutions of multiple monitorsReport Computer Problem, for your IT help deskProfile Fixer, fixes a 'missing' AD user profile
Moderators Melba23 Posted April 29, 2010 Moderators Posted April 29, 2010 jftuga, Yes. And you can do it like this: Run("Calc.exe") WinWait("Calculator") TraySetIcon("Calc.exe") Opt("TrayOnEventMode", 1) ; Use event trapping for tray menu Opt("TrayMenuMode", 3) ; Default tray menu items will not be shown. $hTray_Show_Item = TrayCreateItem("Hide") TrayItemSetOnEvent(-1, "To_Tray") TrayCreateItem("") TrayCreateItem("Exit") TrayItemSetOnEvent(-1, "On_Exit") While 1 Sleep(10) WEnd Func On_Exit() WinKill("Calculator") Exit EndFunc Func To_Tray() If TrayItemGetText($hTray_Show_Item) = "Hide" Then WinSetState("Calculator", "", @SW_HIDE) TrayItemSetText($hTray_Show_Item, "Show") Else WinSetState("Calculator", "", @SW_SHOW) TrayItemSetText($hTray_Show_Item, "Hide") EndIf EndFunc I hope that is what you wanted. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
jftuga Posted April 29, 2010 Author Posted April 29, 2010 This worked like a champ! Thanks! Admin_Popup, show computer info or launch shellRemote Manager, facilitates connecting to RDP / VNCProc_Watch, reprioritize cpu intensive processesUDF: _ini_to_dict, transforms ini file entries into variablesUDF: monitor_resolutions, returns resolutions of multiple monitorsReport Computer Problem, for your IT help deskProfile Fixer, fixes a 'missing' AD user profile
rdwray Posted March 8, 2012 Posted March 8, 2012 M23, I know this is not a new post, but I would like to get some expanded information. I am running a program called "TrayIt" which I am sure some are familiar with. The unique ability over the example script is that TrayIt is not dedicated to just one application, but allows the addition of others and runs in the background and invisible to the user - simply hit the applications minimize button and it goes to the tray. I would like to be able to add the close button and send the app to the tray like one add-on does for Thunderbird by target program for now. “No other God have I but Thee; born in a manger, died on a tree.” Martin Luther
Moderators Melba23 Posted March 8, 2012 Moderators Posted March 8, 2012 rdwray,Looking for an app to be minimized and then sending it to the tray is not too difficult - especially if you only use a single icon with a context menu as I showed above. Intercepting the closure [X] is another matter - I do not think you can do that to a third party app. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
rdwray Posted March 8, 2012 Posted March 8, 2012 rdwray, Looking for an app to be minimized and then sending it to the tray is not too difficult - especially if you only use a single icon with a context menu as I showed above. Intercepting the closure [X] is another matter - I do not think you can do that to a third party app. M23 M23, I took the routine above and tried to add "GUISetOnEvent($GUI_EVENT_MINIMIZE, "To_Tray")" so that "Calculator"s minimize would be intercepted and it never worked - Calc stayed normal, and even with a MsgBox as a check was never activated. I also noticed that there is a $GUI_EVENT_CLOSE; see "added" in code. Help file says: Defines a user function to be called when a system button is clicked." expandcollapse popup#include <GUIConstantsEx.au3> ; added Run("Calc.exe") WinWait("Calculator") TraySetIcon("Calc.exe") Opt("TrayOnEventMode", 1) ; Use event trapping for tray menu Opt("TrayMenuMode", 3) ; Default tray menu items will not be shown. Opt("GUIOnEventMode", 1) ; added $hTray_Show_Item = TrayCreateItem("Hide") TrayItemSetOnEvent(-1, "To_Tray") TrayCreateItem("") TrayCreateItem("Exit") TrayItemSetOnEvent(-1, "On_Exit") GUISetOnEvent($GUI_EVENT_MINIMIZE, "To_Tray") ; added While 1 Sleep(10) WEnd Func On_Exit() WinKill("Calculator") Exit EndFunc Func To_Tray() MsgBox(0,0,0) ; added If TrayItemGetText($hTray_Show_Item) = "Hide" Then WinSetState("Calculator", "", @SW_HIDE) TrayItemSetText($hTray_Show_Item, "Show") Else WinSetState("Calculator", "", @SW_SHOW) TrayItemSetText($hTray_Show_Item, "Hide") EndIf EndFunc “No other God have I but Thee; born in a manger, died on a tree.” Martin Luther
Moderators Melba23 Posted March 8, 2012 Moderators Posted March 8, 2012 rdwray,The events mentioned in the Help file are the ones sent by a GUI you have created in your own script - we are talking here of third party apps. Intercepting their messages is much more difficult and I believe you need an external DLL to do it - here is something I coded a while back to show how you can indeed intercept some messages from third party apps with a DLL. However, I have real reservations about whether you can intercept a closure [X] at all. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
rdwray Posted March 8, 2012 Posted March 8, 2012 M23, I am going to hibernate on this one, thanks... “No other God have I but Thee; born in a manger, died on a tree.” Martin Luther
rdwray Posted March 14, 2012 Posted March 14, 2012 M23, cannot this C++ file (attached) be implemented in au3?RBTray.zip “No other God have I but Thee; born in a manger, died on a tree.” Martin Luther
Moderators Melba23 Posted March 14, 2012 Moderators Posted March 14, 2012 rdwray, Quite possibly - I linked to a script which used an external DLL and I dare say this uses similar calls. But I have my doubts that you can do it from within an AutoIt script given the interprocess boundaries that Windows uses. Anyway, I am not volunteering to do it - why do you not give it a try yourself? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
rdwray Posted March 14, 2012 Posted March 14, 2012 rdwray,Quite possibly - I linked to a script which used an external DLL and I dare say this uses similar calls. But I have my doubts that you can do it from within an AutoIt script given the interprocess boundaries that Windows uses. Anyway, I am not volunteering to do it - why do you not give it a try yourself? M23Interprocess - sounds like it may be a wall. I am looking at some scripts that use the non-client area and I may get a headache before this one is over - to dump to stop. “No other God have I but Thee; born in a manger, died on a tree.” Martin Luther
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