Dirk98 Posted September 20, 2007 Share Posted September 20, 2007 Guys, I have a software that creates it's own item in the tray. It is not standard Windows type (shows its own menus when clicked on). I need to close it before running anything else in the script. I also run this software later in the script again and need to select items from the menu that pops up. Can you please give an example of how to manage this. Many thanks. Link to comment Share on other sites More sharing options...
Zedna Posted September 20, 2007 Share Posted September 20, 2007 Look here Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Dirk98 Posted September 20, 2007 Author Share Posted September 20, 2007 Look hereZedna, thank you! Gotta love these boards. Link to comment Share on other sites More sharing options...
Zedna Posted September 20, 2007 Share Posted September 20, 2007 (edited) Zedna, thank you! Gotta love these boards. I love this board too EDIT: I'm still learning something new about AutoIt and Win32 API ... Edited September 20, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Dirk98 Posted September 20, 2007 Author Share Posted September 20, 2007 Ok, I've learnt how to manipulate the tray items, but I also need to kill the process, along with the tray item. Could you pls give me a pointer on how to kill a running exe process? Many thanks. Link to comment Share on other sites More sharing options...
Zedna Posted September 20, 2007 Share Posted September 20, 2007 Ok, I've learnt how to manipulate the tray items, but I also need to kill the process, along with the tray item. Could you pls give me a pointer on how to kill a running exe process? Many thanks.If in it's tray popupmenu is Exit command then invoke it - this is simplest way.Otherwise you may use ProcessClose() Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Dirk98 Posted September 20, 2007 Author Share Posted September 20, 2007 (edited) If in it's tray popupmenu is Exit command then invoke it - this is simplest way. Otherwise you may use ProcessClose() Just to click on GFKeys.exe icon in the tray (required for my task) I have to do all this quoted below. Now, there are 4 commands in the popup menue of GFKeys.exe : "Show Config Panel", "Disable Key Mapping", "Enable Key Mapping", "Quit GFKeys". Any ideas what else to add to the code below to be able to pick different commands from the menu, say: "Enable Key Mapping"? Many thanks. expandcollapse popup#include "SysTray_UDF.au3" ; -- Example 5 -- ; Left-click Outlook's icon on system tray ; Press hide inactive icon's button part is from Valik's refresh system tray script! $oldMatchMode = Opt("WinTitleMatchMode", 4) $oldChildMode = Opt("WinSearchChildren", 1) $class = "classname=Shell_TrayWnd" $hControl = ControlGetHandle($class, "", "Button2") ; get tray position and move there. Helps if Auto Hide tray option is used. $posTray = WinGetPos(_FindTrayToolbarWindow()) MouseMove($posTray[0], $posTray[1]) $index = _SysTrayIconIndex("GFKeys.exe"); Change this to some other application if needed If $index <> -1 Then $pos = _SysTrayIconPos($index) If $pos = -1 Then ; ***** Moved by CatchFish ***** ; If XP and the Hide Inactive Icons mode is active If $hControl <> "" And ControlCommand($class, "", $hControl, "IsVisible","") Then ControlClick($class, "", $hControl) Sleep(250); Small delay to allow the icons to be drawn EndIf ; ****************************** $pos = _SysTrayIconPos($index) If $pos = -1 Then Exit; ** A real error this time;) EndIf MouseMove($pos[0], $pos[1]) Sleep(1000) MouseClick("left") EndIf ConsoleWrite(@CRLF & @CRLF & "Pos[0]: " & $pos[0] & "$pos[1]: " & $pos[1]) ; Restore Opt settings Opt("WinTitleMatchMode", $oldMatchMode) Opt("WinSearchChildren", $oldChildMode) Edited September 20, 2007 by Dirk98 Link to comment Share on other sites More sharing options...
Dirk98 Posted September 21, 2007 Author Share Posted September 21, 2007 Guys, just bumping. Badly need to select different options in the custom popupmenus after I clicked on the GFKeys.exe's icon in the tray. Thank you. Link to comment Share on other sites More sharing options...
Zedna Posted September 21, 2007 Share Posted September 21, 2007 Guys, just bumping. Badly need to select different options in the custom popupmenus after I clicked on the GFKeys.exe's icon in the tray. Thank you.Man are you blind? Look at my post #2! Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Dirk98 Posted September 21, 2007 Author Share Posted September 21, 2007 (edited) Man are you blind? Look at my post #2! Zedna, unfortunately the script quted on that page does not work here (on my english OS): #include <A3LMenu.au3> #include <A3LToolbar.au3> Opt("WinTitleMatchMode", 4) $hWnd = ControlGetHandle("classname=Shell_TrayWnd", "", "Notification Area") $iCount = _Toolbar_ButtonCount($hwnd) for $iI = 1 to $iCount $iCommand = _Toolbar_IndexToCommand($hWnd, $iI) $sText = _Toolbar_GetButtonText ($hWnd, $iCommand) if $sText = "Volume" then if ControlGetHandle("classname=Shell_TrayWnd", "", "Button2") <> 0 then ControlClick("classname=Shell_TrayWnd", "", "Button2") endif _Toolbar_ClickButton($hWnd, $iCommand, "right", False, 1, 1, True) _Menu_ClickPopupAccel("O") ExitLoop endif next I get Error on line 26: _Toolbar_ClickButton($hWnd, $iCommand, "right", False, 1, 1, True) ^ERROR Error: Incorrect number of parameters in function call. So, I'm stuck on my script since the exemplary one you referred to doesn't work. Any ideas? Many thanks. Edited September 21, 2007 by Dirk98 Link to comment Share on other sites More sharing options...
Zedna Posted September 21, 2007 Share Posted September 21, 2007 Zedna, unfortunately the script quted on that page does not work here (on my english OS): #include <A3LMenu.au3> #include <A3LToolbar.au3> Opt("WinTitleMatchMode", 4) $hWnd = ControlGetHandle("classname=Shell_TrayWnd", "", "Notification Area") $iCount = _Toolbar_ButtonCount($hwnd) for $iI = 1 to $iCount $iCommand = _Toolbar_IndexToCommand($hWnd, $iI) $sText = _Toolbar_GetButtonText ($hWnd, $iCommand) if $sText = "Volume" then if ControlGetHandle("classname=Shell_TrayWnd", "", "Button2") <> 0 then ControlClick("classname=Shell_TrayWnd", "", "Button2") endif _Toolbar_ClickButton($hWnd, $iCommand, "right", False, 1, 1, True) _Menu_ClickPopupAccel("O") ExitLoop endif next I get Error on line 26: _Toolbar_ClickButton($hWnd, $iCommand, "right", False, 1, 1, True) ^ERROR Error: Incorrect number of parameters in function call. So, I'm stuck on my script since the exemplary one you referred to doesn't work. Any ideas? Many thanks. Last parameter was redundant. Try this: _Toolbar_ClickButton($hWnd, $iCommand, "right", False, 1, 1) And search forum AutoIt/Auto3Library helkpfile for more details/examples. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Dirk98 Posted September 21, 2007 Author Share Posted September 21, 2007 (edited) Last parameter was redundant. Try this: _Toolbar_ClickButton($hWnd, $iCommand, "right", False, 1, 1) And search forum AutoIt/Auto3Library helkpfile for more details/examples. Zedna, you are the saviour, thx man! Would take me 100 years following what you suggested. But I'm trying. Edited September 21, 2007 by Dirk98 Link to comment Share on other sites More sharing options...
Dirk98 Posted September 21, 2007 Author Share Posted September 21, 2007 (edited) But there's a problem in the above script again. If I change "Button2" to "Button1" the script still opens the same Play Control, instead of Sounds and Audio Devices Properties. Which negates any control over selection to make. And that's what I needed originally. If it doesn't work with the native windows' uplets, it won't work in custom ones I guess. Any idea how I can change the selections in the popup menu of the tray in the above example? Thanks. Edited September 21, 2007 by Dirk98 Link to comment Share on other sites More sharing options...
Dirk98 Posted September 21, 2007 Author Share Posted September 21, 2007 Zedna, pls, any idea why changing Button2 to Button1 (or any other numbers) in the above scrip doesn't make different selections in the tray popup menu? I need to learn a way how to select different items in the tray icon popup. Many thanks, sorry for stalking. Link to comment Share on other sites More sharing options...
Zedna Posted September 21, 2007 Share Posted September 21, 2007 Zedna, pls, any idea why changing Button2 to Button1 (or any other numbers) in the above scrip doesn't make different selections in the tray popup menu? I need to learn a way how to select different items in the tray icon popup.Many thanks, sorry for stalking. I didn't used tray automatize in any of my projects so I don't know details. Just try to search Auto3Library helpfile and forum for examples which are using these functions. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Dirk98 Posted September 21, 2007 Author Share Posted September 21, 2007 I didn't used tray automatize in any of my projects so I don't know details. Just try to search Auto3Library helpfile and forum for examples which are using these functions.Thank you, Zedna. I've found some pertinent references in the Auto3Lib Help but too hard to comprehend. I'll ask it again and refined on the forum. 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