Jump to content

tray problem


Recommended Posts

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 widgets

when 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")

EndFunc

Func sidebar2()

ProcessClose("sidebar.exe")

EndFunc

while 1

_ReduceMemory()

HotKeySet("!s", "sidebar")

HotKeySet("!c", "sidebar2")

;some other stuff here too

WEnd

Link to comment
Share on other sites

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 by Authenticity
Link to comment
Share on other sites

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

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

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

#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

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

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 by aphesia
Link to comment
Share on other sites

^_^ 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...