Sign in to follow this  
Followers 0
WhiteAvenger

Hide Toolbar Items

12 posts in this topic

Hi,

is it possible to hide Toolbar items? I.e. when I minimize Outlook, it goes to the tray rather than the toolbar.

Can I use AutoIt to do the same for other programs?

The program doesn't necessarily have to go to the tray, but I want the toolbar item to disappear and reappear with an AutoIt script.

Is that possible?

Thanks

--WhiteAvenger

Share this post


Link to post
Share on other sites



Hi,

is it possible to hide Toolbar items? I.e. when I minimize Outlook, it goes to the tray rather than the toolbar.

Can I use AutoIt to do the same for other programs?

The program doesn't necessarily have to go to the tray, but I want the toolbar item to disappear and reappear with an AutoIt script.

Is that possible?

Thanks

--WhiteAvenger

Use _GUICtrlToolbar_SetButtonState() and change the state of the button (taskbar item) to $TBSTATE_HIDDEN.

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Use _GUICtrlToolbar_SetButtonState() and change the state of the button (taskbar item) to $TBSTATE_HIDDEN.

:)

How do I get the handle of the Toolbar item?

Share this post


Link to post
Share on other sites

How do I get the handle of the Toolbar item?

You can use ControlGetHandle() for the toolbar itself, then you use index and CommandID, not handle, for the individual controls on the toolbar. Look at _GUICtrlToolbar_CommandToIndex() and _GUICtrlToolbar_IndexToCommand() in the current Beta help file.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

You can use ControlGetHandle() for the toolbar itself, then you use index and CommandID, not handle, for the individual controls on the toolbar. Look at _GUICtrlToolbar_CommandToIndex() and _GUICtrlToolbar_IndexToCommand() in the current Beta help file.

I can't find those in the help file...

Could you possibly help me with the code? I have no idea how to use the GUICtrlToolbar functions... :)

Share this post


Link to post
Share on other sites

I can't find those in the help file...

Could you possibly help me with the code? I have no idea how to use the GUICtrlToolbar functions... :)

What versions (Prod and Beta) of AutoIt do you have? Are you using the Beta help file? It won't do any good to proceed if you don't have the current versions.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Sorry to revive this old topic, but I'm working on it again...

I can get the handle of the toolbar with ControlGetHandle("[CLASS:ToolbarWindow32]","",""), but how do I then find the controlID of the exact toolbar item I'm looking for? And what is the command to then set its state to $TBSTATE_HIDDEN?

Share this post


Link to post
Share on other sites

Sorry to revive this old topic, but I'm working on it again...

I can get the handle of the toolbar with ControlGetHandle("[CLASS:ToolbarWindow32]","",""), ...

You can? With the control identity in the Window Title parameter?

...but how do I then find the controlID of the exact toolbar item I'm looking for? And what is the command to then set its state to $TBSTATE_HIDDEN?

Try some of the example scripts with the _GuiCtrlToolBar_* functions in the help file. You did get the current version (3.3.0.0), right?

If you check out the help file for _GUICtrlToolbar_SetButtonState(), you will see it needs the handle for the toolbar, and the "CommandID" for the button, not it's ControlID. A CommandID is something like a ControlID, but is only valid for items within that control. The CommandID is used because it remains constant even if other items are added/deleted/sorted changing the index no. of the items, but not their CommandIDs.

Use _GUICtrlToolbar_ButtonCount() to get a count and then loop through the indexes getting the CommandID with _GUICtrlToolbar_IndexToCommand() and then checking for the right text with _GUICtrlToolbar_GetButtonText(). Once you find the one you want, use _GUICtrlToolbar_SetButtonState() with $TBSTATE_HIDDEN.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

You can? With the control identity in the Window Title parameter?

Heh, checking with AutoIt Window Info, I apparently can't...

How do I get the correct handle?

Share this post


Link to post
Share on other sites

Heh, checking with AutoIt Window Info, I apparently can't...

How do I get the correct handle?

Use the AutoIt Window Info tool to get a good reference to the window, and to the toolbar control. Try the Summary Tab while the app window is active and the mouse is on the toolbar. Hit Ctrl-Alt-f to freeze the display.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Use the AutoIt Window Info tool to get a good reference to the window, and to the toolbar control. Try the Summary Tab while the app window is active and the mouse is on the toolbar. Hit Ctrl-Alt-f to freeze the display.

:)

I can't get a clear handle on the taskbar itself...

This is what AutoIt Window Info tells me:

>>>> Window <<<<

Title:

Class: Shell_TrayWnd

Position: 0, 1020

Size: 1680, 30

Style: 0x96000000

ExStyle: 0x00000088

Handle: 0x00030058

>>>> Control <<<<

Class: ToolbarWindow32

Instance: 2

ClassnameNN: ToolbarWindow322

Advanced (Class): [CLASS:ToolbarWindow32; INSTANCE:2]

ID:

Text: Running Applications

Position: 181, 0

Size: 1321, 30

ControlClick Coords: 1177, 12

Style: 0x52009345

ExStyle: 0x00000000

Handle: 0x0001008A

>>>> Mouse <<<<

Position: 1358, 1032

Cursor ID: 2

Color: 0x5B5B5B

>>>> StatusBar <<<<

>>>> Visible Text <<<<

start

21:17

Notification Area

Running Applications

Running Applications

Quick Launch

>>>> Hidden Text <<<<

WMP9DeskBand

Using ControlGetHandle("[CLASS:Shell_TrayWnd]","Running Applications","") gives me the whole taskbar, start button and all - but that doesn't have any buttons, so I'm guessing I'm handling the wrong object.

Can you tell me how to get a clear handle on the taskbar item itself? [CLASS:ToolbarWindow32] always returns something different.

Also, If you know exactly how to do this, I'd be really grateful if you let me learn from your example rather than having me find this out myself...

Share this post


Link to post
Share on other sites

I can't get a clear handle on the taskbar itself...

This is what AutoIt Window Info tells me:

Using ControlGetHandle("[CLASS:Shell_TrayWnd]","Running Applications","") gives me the whole taskbar, start button and all - but that doesn't have any buttons, so I'm guessing I'm handling the wrong object.

Can you tell me how to get a clear handle on the taskbar item itself? [CLASS:ToolbarWindow32] always returns something different.

Also, If you know exactly how to do this, I'd be really grateful if you let me learn from your example rather than having me find this out myself...

On XP Pro SP2 these are the system tray and the taskbar, respectively:
$hSystemTray = ControlGetHandle("[CLASS:Shell_TrayWnd]","","[CLASS:ToolbarWindow32; INSTANCE:1]")
$hTaskBar = ControlGetHandle("[CLASS:Shell_TrayWnd]","","[CLASS:ToolbarWindow32; INSTANCE:2]")

I have posted other scripts in this forum for using GuiToolBar.au3 UDF functions with these. Search is your friend.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
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
Sign in to follow this  
Followers 0