sulfurious Posted January 28, 2008 Share Posted January 28, 2008 (edited) I posted my original question in the graphical forum.. http://www.autoitscript.com/forum/index.php?showtopic=62801Now I think it is possibly not a graphical question. How does one trigger the tray? Not a button in the tray, or a menu in the tray, but the tray itself. Just like the windows key opens menu's and submenu's, I wish to do that with the autoit tray menu. However, I have been looking and find plenty of manipulations for buttons and objects OF the tray menu, but not the tray menu itself.TraySetState() has nothing to 'pop up' the tray. Something along the lines of GUICtrlSetState('tray handle',$GUI_Show) would be sort of what I envision, but I cannot find the 'handle' of the tray menu to try anything on.EDIT: I should state that I am using OnEvent mode, and that I do not wish to trigger anything in the tray menu, just display the tray menu so I can navigate it with the keyboard. I have been using a hotkey to trigger the tray menu pop up, but no luck yet...Is this possible?Believe me, I have plenty of posts bookmarked, but have found nothing to solve this.Any suggestions?Thanks.Sul. Edited January 28, 2008 by sulfurious Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted January 28, 2008 Share Posted January 28, 2008 (edited) If you just want to hide and show Opt("TrayIconHide",1) Sleep(2000) Opt("TrayIconHide",0) Sleep(2000) Edited January 28, 2008 by Thatsgreat2345 Link to comment Share on other sites More sharing options...
MrCreatoR Posted January 28, 2008 Share Posted January 28, 2008 Hi,Try the SysTray_UDF, i think it can help you. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
MrCreatoR Posted January 28, 2008 Share Posted January 28, 2008 If you just want to hide and showI think he need to show the main menu of the tray icon, just like when you cllick on the icon Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
SadBunny Posted January 28, 2008 Share Posted January 28, 2008 I think he need to show the main menu of the tray icon, just like when you cllick on the icon I seem to have accidentally answered your initial post... Don't know if my suggestion helps but be sure to check it out Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
sulfurious Posted January 28, 2008 Author Share Posted January 28, 2008 Yes, I have been playing with the systray udf. However, it seems to hide/show the icon, not actually 'pop up' the tray menu. It can be called to move the mouse to the tray icon, then you can invoke say a mouse click at that x,y postition, which does spawn the tray menu. While I am not completely opposed to doing it that way, it seems there should be a way to do it in code. Maybe not though. And yes MsCreatoR, you are correct, I don't need to hide the icon or anything of that nature. Matter of fact, I don't need to manipulate anything within the tray menu, I can do that already. Just show it through code, preferably without the mouse action going on. Like I say though, that may be the only way to achieve it. Thanks for the input so far though. Appreciate it. SadBunny -- that is an interesting approach. It does work to a degree, except you can never be certain how many tabs to move over. Moreover, if you have a toolbar on the taskbar, as I do, it seems to always want to open it when it tabs to it, and does not like to proceed to the next item. In that instance it also pops it open and then drops it away just as quick, spawning the send() action with a hotkey anyway. But thanks for the reply. I might try to work somethign off that idea. I wonder though what ramifications it would have to many open windows, perhaps shifting thier layering or something when not wanted. Thanks again. Sul. Link to comment Share on other sites More sharing options...
SadBunny Posted January 28, 2008 Share Posted January 28, 2008 SadBunny -- that is an interesting approach. It does work to a degree, except you can never be certain how many tabs to move over. Moreover, if you have a toolbar on the taskbar, as I do, it seems to always want to open it when it tabs to it, and does not like to proceed to the next item. In that instance it also pops it open and then drops it away just as quick, spawning the send() action with a hotkey anyway. But thanks for the reply. I might try to work somethign off that idea. I wonder though what ramifications it would have to many open windows, perhaps shifting thier layering or something when not wanted. Thanks again.It shouldn't do anything to the opened windows... You'd just be TABbing through them like you tab through everything else in windows. Since it doesn't activate or de-activate any windows it shouldn't change anything.Maybe just experiment manually with ctrl+esc and tab - you'll know fast enough Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
SadBunny Posted January 28, 2008 Share Posted January 28, 2008 (edited) Hey, how about this? Send("^{ESC}{ESC}+{TAB}{TAB}") It doesn't tab through quicklaunch or app, but shift+tab twice to tab backwards, going from start button > nothing > systray. It should avoid open apps, toolbars, quicklaunch and the like. Though I'm not sure about the toolbar. But I presume, tab-wise it's between start menu and systray? (So this new procedure doesn't come across it while the old one probably would.) It's the same quick and dirty approach but it should be less dependant on rest of taskbar layout? Edited January 28, 2008 by SadBunny Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
sulfurious Posted January 28, 2008 Author Share Posted January 28, 2008 Hmm. I am learning some new stuff it would appear. By manually triggering your dirtly little method , I can get it to land on where I want. Next, I am using the systray udf / example to find the icon to stop on. Here is what a compiled script has as a title #0Title: AutoIt v3, process: AutoIt3Wrapper.exeAnd here is another compiled script running (that is 2 icons in tray, one for each compiled script)#1Title: AutoIt v3, process: AutoIt3Wrapper.exeWhich, I suppose if I only had 1 compiled script running, I could search for that and then find the index and know how many to tab to. However, unless I have missed the way to declare what the process is called, I don't know what to do for logic on it now.Perhaps I could search on a tooltip using systray udf.It sure seems there would be a handle one could get to the tray itself though.Keep em coming, learning new stuff here.Thanks again.Sul. Link to comment Share on other sites More sharing options...
SadBunny Posted January 28, 2008 Share Posted January 28, 2008 Hmm. I am learning some new stuff it would appear. By manually triggering your dirtly little method , I can get it to land on where I want. Next, I am using the systray udf / example to find the icon to stop on. Here is what a compiled script has as a title And here is another compiled script running (that is 2 icons in tray, one for each compiled script)Which, I suppose if I only had 1 compiled script running, I could search for that and then find the index and know how many to tab to. However, unless I have missed the way to declare what the process is called, I don't know what to do for logic on it now.Perhaps I could search on a tooltip using systray udf.It sure seems there would be a handle one could get to the tray itself though.Keep em coming, learning new stuff here.Thanks again.Sul.Don't know any more... Too late here, calling it a day at 23:30... Hope you find out anything! Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
Squirrely1 Posted January 28, 2008 Share Posted January 28, 2008 (edited) How does one trigger the tray...menu [to open?]MsCreatoR pointed you in the right direction when he gave you the link to the UDF: You just use taupe's function, add a couple of pixels to the (x, y) result, and use MouseClick to right-click at those coord's: ;=============================================================================== ; ; Function Name: _SysTrayIconPos($iIndex=0) ; Description: Gets x & y position of systray icon ; Parameter(s): $iIndex = icon index (Note: starting from 0) ; ; Requirement(s): AutoIt3 Beta ; Return Value(s): On Success - Returns x [0] and y [1] position of icon ; On Failure - Returns -1 if icon is hidden (Autohide on XP etc.) ; Sets error to 1 if some internal error happens ; ; Author(s): Tuape ; ;=============================================================================== Edited January 28, 2008 by Squirrely1 Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
sulfurious Posted January 28, 2008 Author Share Posted January 28, 2008 (edited) MsCreatoR pointed you in the right direction when he gave you the link to the UDF: You just use taupe's function, add a couple of pixels to the (x, y) result, and use MouseClick to right-click at those coord's:Yes, thank you. I have that working by using the mouse. However, that may work, but it is not the most elegant way to do this. I have used mouse movements in some projects, but try to steer clear of anything that rips the mouse from my hand. I suppose just preference. SadBunny's method does have some merit in regards to being invisible and not taking away the mouse from user control. Here is what is supposed to work from the systray udfFor $u = 0 To _SystrayIconCount () ConsoleWrite(@CR & "#" & $u & ' : ' & _SysTrayIconTooltip($u) & ' --> ' & _SysTrayIconIndex(_SysTrayIconTooltip($u),2)) Next Let us say that the compiled script is called script.exe. I can find the PID = AutoIt v3.exe. I can however find the script.exe in the tooltip variable, so I have a target to search for. Now I search for the index, which I am to assume is where it is located in the tray. Once I find that I could use a method to TAB to it as SadBunny suggests. However, the snippet returns always index of -1, which is being declared as ; Return Value(s): On Success - Returns index of found icon ; On Failure - Returns -1 if icon for given process/wintitle ; was not found. ; - Sets error to 1 and returns -1 in case of bad ; arguments So, I am unsure of what is going wrong. According to function descriptions, this should work, or maybe I am not correct. Thank you for your reply. Sul. Edited January 28, 2008 by sulfurious Link to comment Share on other sites More sharing options...
sulfurious Posted January 28, 2008 Author Share Posted January 28, 2008 (edited) So here we have in interesting find. If I use systray udf, I can find the count of all tray icons. Next I wish to show the process names, using the systray example like this; -- Example 1 -- ; Get window titles of all windows that have icon on systray $iTitles = _SysTrayIconTitles () ; Get process names of all processes that have icon on systray $iProcesses = _SysTrayIconProcesses () For $i = 0 To UBound($iTitles) - 1 ; write the info to consolewindow ConsoleWrite(@CR & "#" & $i & "Title: " & $iTitles[$i] & ", process: " & $iProcesses[$i]) Next This returns the processes OK. But not a compiled autoit script. What is returned, again, is #0Title: AutoIt v3, process: AutoIt3Wrapper.exe. This short circuits using the _SysTrayIconIndex($name, $mode=0), where $name can be a 'process name / window title text' and $mode can be 0=process name, 1=window title or 2=tooltip It is interesting that if you even hard code in the 'tooltip' text, the iconindex always returns -1. It is highly likely that I am not doing this correctly. Here is my test code, obviously change the compiled .exe name (tooltip text) to match a test exe. For $u = 0 To _SystrayIconCount () ConsoleWrite(@CR & "#" & $u & ' : ' & _SysTrayIconTooltip($u) & ' --> ' & _SysTrayIconIndex("sg-menu.exe",2)) Next ;~ Exit ; -- Example 1 -- ; Get window titles of all windows that have icon on systray $iTitles = _SysTrayIconTitles () ; Get process names of all processes that have icon on systray $iProcesses = _SysTrayIconProcesses () For $i = 0 To UBound($iTitles) - 1 ; write the info to consolewindow ConsoleWrite(@CR & "#" & $i & "Title: " & $iTitles[$i] & ", process: " & $iProcesses[$i]) Next Exit Thanks for any help. Sul. EDIT: as a matter of fact, using the example script for systray udf, changing the example processes (bittorrent.exe and feedreader.exe) to my compiled script name (both case sensitive and not), caused the icon index not to work at all unless the compiled script resided at the first slot. If you load up a compiled script, and then start another app that has a tray icon, the default seems to go to the left most icon. Very intersting that the iconindex funtion, while working on a normal app with name=tooltip text and mode=2, does not work an autoit compiled script. Hmm. Edited January 28, 2008 by sulfurious Link to comment Share on other sites More sharing options...
Squirrely1 Posted January 28, 2008 Share Posted January 28, 2008 (edited) SadBunny's method does have some merit in regards to being invisible and not taking away the mouse from user control. The experimental methods of going about getting the tray menu to open seem very interesting. For me, I am old and life is too short. This takes only 86 milliseconds out of my life: $x = TimerInit() MouseClick("right", 931, 752, 1, 0) MsgBox(0,"",TimerDiff($x));returns "86" milliseconds Be sure to backup the mouse cursor position, because I found out that MouseClick does not, in this case at least, move the mouse cursor back to where he got it - an additional 90 milliseconds out of my life - gone forever. Edited January 29, 2008 by Squirrely1 Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
sulfurious Posted January 28, 2008 Author Share Posted January 28, 2008 The other way you are going about getting the tray menu to open seem very interesting. For me, I am old and life is too short. This takes only 86 milliseconds out of my life:lol, very true, tis the long way around. I just can't stand not knowing though.Sul. Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted January 28, 2008 Share Posted January 28, 2008 The other way you are going about getting the tray menu to open seem very interesting. For me, I am old and life is too short. This takes only 86 milliseconds out of my life: $x = TimerInit() MouseClick("right", 931, 752, 1, 0) MsgBox(0,"",TimerDiff($x));returns "86" milliseconds It won't be in the same position every time.... I know your trying to help and all but if you are going to post something thats just a send, or a mouseclick that isn't all to useful don't post. Link to comment Share on other sites More sharing options...
Squirrely1 Posted January 29, 2008 Share Posted January 29, 2008 (edited) It won't be in the same position every time.... I know your trying to help and all but if you are going to post something thats just a send, or a mouseclick that isn't all to useful don't post.My suggestion was not intended as a complete solution. Since MSCreatoR gave the whole solution away on a silver platter, and some people still didn't get it, I was trying to add another clue for people still scratching their heads.MsCreatoR's technique, which uses taupe's neatly-written wonderful new functions, will reliably and inevitably open those menus every time it's tried, within about a quarter of a second, no matter where in the tray the icon has moved to - Thatsgreat2345.That said - I do have respect for those pursuing an even quicker and more reliable way to open the tray menu.Maybe you need some brain food or something, but I'm going to have to refer you directly from here to Verse 2 of the Official Canon of Valik, found below in my signature. Edited January 29, 2008 by Squirrely1 Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
psylem Posted January 29, 2008 Share Posted January 29, 2008 It's so simple you'll kick yourself... WinGetHandle("[CLASS:Shell_TrayWnd]") Using Opt("WinTitleMatchMode", 4) or AutoItSetOption("WinTitleMatchMode", 4) Link to comment Share on other sites More sharing options...
Squirrely1 Posted January 29, 2008 Share Posted January 29, 2008 You plainly haven't read much of this thread at all. It is nothing personal, but just so you can be in on the fun too, I hereby refer you to Verse 1 of the Official Canon of Valik, listed below in my signature. Das Häschen benutzt Radar Link to comment Share on other sites More sharing options...
psylem Posted January 29, 2008 Share Posted January 29, 2008 You plainly haven't read much of this thread at all. It is nothing personal, but just so you can be in on the fun too, I hereby refer you to Verse 1 of the Official Canon of Valik, listed below in my signature. Thanks for your contribution so far to solving this problem but I think I can take it from here. If I didn't skim over threads I'd spend my whole day reading useless dribble from people like you. The guy was just asking for a good solution, he wasn't happy with yours. It is nothing personal, get over it. So how about this then... Opt("WinSearchChildren", 1) Opt("WinTitleMatchMode", 4) WinActivate("[CLASS:TrayNotifyWnd]") Does that do exactly what he wants now? 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