aphesia Posted April 18, 2009 Share Posted April 18, 2009 hello, i´m currently working on little script with should make the vista sidebar to smth like the max dashboard:when pressing alt+s , sidebar.exe starts with all my widgetswhen pressing alt+c the process will be closed.the only problem: the sidebar icon keeps in the tray until i move the mouse on it. how can i solve this?script:#include <reducemem.au3>#include <Constants.au3>Func sidebar() run(@ProgramFilesDir & "\Windows Sidebar\sidebar.exe")EndFuncFunc sidebar2() ProcessClose("sidebar.exe")EndFuncwhile 1_ReduceMemory()HotKeySet("!s", "sidebar")HotKeySet("!c", "sidebar2");some other stuff here too WEnd Link to comment Share on other sites More sharing options...
Richard Robertson Posted April 18, 2009 Share Posted April 18, 2009 That is because you are terminating the process instead of letting it shutdown correctly. Is there a menu or something you can click to make it close correctly? Link to comment Share on other sites More sharing options...
aphesia Posted April 18, 2009 Author Share Posted April 18, 2009 right click tray icon -> left click exit (not alt-shortcut possible) thats all i know about closeing the sidebar correctly. i thought about processclose + tray refresh but i think smth like that doesnt exist Link to comment Share on other sites More sharing options...
Authenticity Posted April 18, 2009 Share Posted April 18, 2009 (edited) You can use Winspector or Spy++ to see which message it sends (which may be constant) and send it to the window or the control. You can also use _GUICtrlToolBar_* to preform a mouse click to show the dialog window and preform another click to click on the exit menu. Edited April 18, 2009 by Authenticity Link to comment Share on other sites More sharing options...
Richard Robertson Posted April 18, 2009 Share Posted April 18, 2009 Actually, yes, inspecting the window message would be the nicest solution. Link to comment Share on other sites More sharing options...
aphesia Posted April 19, 2009 Author Share Posted April 19, 2009 i never used one of these programms and also i never coded something like that. so i atm have absolutly no clue what you guys are talking about a programm which spys what happens when i press exit in windows sidebar. And then i can use this somehow in autoit to exit it without clicking on exit. will dl this programms and try my luck thanks Link to comment Share on other sites More sharing options...
Authenticity Posted April 19, 2009 Share Posted April 19, 2009 Requires a little understanding of API and control messages. If you don't have those you can read on MSDN or use the second method of using _GUICtrlToolBar_* functions to click the program tray icon to open the dialog and then just use WinSpy to get something to help you uniquely identify the new dialog characteristics and wait for it to be active... then just Send("{UP}{ENTER}") or something. ;] Link to comment Share on other sites More sharing options...
aphesia Posted April 19, 2009 Author Share Posted April 19, 2009 hmm dont really want smth like send/mouseclick as this would rly stop the feeling oh a dashboard but i havent check these things yet.. will do it tonight as i´m going into the sun now. if anyone got an example or smth , would rly need it thx Link to comment Share on other sites More sharing options...
Authenticity Posted April 19, 2009 Share Posted April 19, 2009 #include <GuiButton.au3> #include <GuiToolBar.au3> Dim $hToolBar = ControlGetHandle('[CLASS:Shell_TrayWnd]', '', 'ToolbarWindow321') Dim $hButton = ControlGetHandle('[CLASS:Shell_TrayWnd]', '', 'Button2') For $i = 0 to _GUICtrlToolbar_ButtonCount($hToolBar)-1 If StringInStr(_GUICtrlToolbar_GetButtonText($hToolBar, _ _GUICtrlToolbar_IndexToCommand($hToolBar, $i)), 'vol') Then ExitLoop Next _GUICtrlButton_Click($hButton) _GUICtrlToolbar_ClickIndex($hToolBar, $i, 'right') WinWait('[W:164; H:40]') ConsoleWrite('Test' & @LF) Dim $hMenu = WinGetHandle('[W:164; H:40]') ControlSend($hMenu, '', '', '+a') If the size of the menu is not the same which may happen you'll need to wait for [CLASS:#32678] or something. Link to comment Share on other sites More sharing options...
aphesia Posted April 19, 2009 Author Share Posted April 19, 2009 well this wont work then if the sidebar tray icon isn´t on the same position all the time.. or am i wrong? Link to comment Share on other sites More sharing options...
Authenticity Posted April 19, 2009 Share Posted April 19, 2009 Not necessary. It's likely that the right click dialog height and width are constants. The tray icon doesn't need to be anywhere specific because $i will be the index of the tray icon to click on. You can change the loop a little bit to be more correct: For $i = 0 To _GUICtrlToolbar_ButtonCount($hToolBar)-1 ; If something Then ; ; Click the toolbar button index and exit the loop. ; ExitLoop ; EndIf ;.... Next Link to comment Share on other sites More sharing options...
aphesia Posted April 19, 2009 Author Share Posted April 19, 2009 hmm dont rly get the script and also dotn get it work will give it a try later again thanks Link to comment Share on other sites More sharing options...
Authenticity Posted April 19, 2009 Share Posted April 19, 2009 Well, if you're using Vista it may be different for you, I use XP. The [W:xx; H:xx] may as well be different for you because it's just to illustrate. Link to comment Share on other sites More sharing options...
aphesia Posted April 20, 2009 Author Share Posted April 20, 2009 (edited) for me it opens the "safely remove hardware" thingy.. hmm Dim $hToolBar = ControlGetHandle('[CLASS:Shell_TrayWnd]', '', 'ToolbarWindow321') Dim $hButton = ControlGetHandle('[CLASS:Shell_TrayWnd]', '', 'Button2') MsgBox(0,"", $hToolBar) MsgBox(0,"", $hButton )htoolbar seems to be right but hbutton = empty Edited April 20, 2009 by aphesia Link to comment Share on other sites More sharing options...
Authenticity Posted April 20, 2009 Share Posted April 20, 2009 Post AutoIt Window Info summary about the '<<' button if you don't mind. ;] Link to comment Share on other sites More sharing options...
aphesia Posted April 20, 2009 Author Share Posted April 20, 2009 whats the << button? Link to comment Share on other sites More sharing options...
Authenticity Posted April 20, 2009 Share Posted April 20, 2009 Or it's '>>' on you machine if it's right to left... It's the button that expands the toolbar so you can see the rest of the tray icons. Link to comment Share on other sites More sharing options...
aphesia Posted April 20, 2009 Author Share Posted April 20, 2009 dont have this icon/button i always see all the tray icons Link to comment Share on other sites More sharing options...
Authenticity Posted April 20, 2009 Share Posted April 20, 2009 Interesting... and the code is not working? So if it you don't need to expand the toolbar then just remove the code that relating to the button and test again. First do an output loop to see if you can successfully see the toolbar buttons text and if you can it may be necessary to change "vol" in the loop to what you need. What is your OS? Link to comment Share on other sites More sharing options...
aphesia Posted April 21, 2009 Author Share Posted April 21, 2009 vista 64 home premium dont rly knwo what this "vol" even means. also: Dim $hButton = ControlGetHandle('[CLASS:Shell_TrayWnd]', '', 'Button2') MsgBox(0,"", $hButton ) the msgbox is empty 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