Jump to content

MsoCommandBar / Word / Control help


Recommended Posts

So I'm trying to get rid of that stupid Navigation bar on the side of word... It's not something needed but as I am getting better with AutoIT I would love to understand how I could do it.

There is no ID in the Control.... And the number at the end of the class may change if it comes back later on... 

Would I have a way to run through each of them until I find the Navigation one and then click on the X?

 

image.thumb.png.0f3b9cd767f89b8e04069771207bcbc8.png

Link to comment
Share on other sites

If you use the Word UDF that comes with AutoIt then this should work (untested):

#include <Word.au3>
$oWord = _Word_Create()
$oWord.ActiveDocument.ActiveWindow.DocumentMap = False

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

49 minutes ago, water said:

If you use the Word UDF that comes with AutoIt then this should work (untested):

#include <Word.au3>
$oWord = _Word_Create()
$oWord.ActiveDocument.ActiveWindow.DocumentMap = False

 

Unfortunately, it's not the script that opens that window... There is a constant process. that processes documents and open Word to render them in TIF files.

So I don't think that would work :( That's why I really need a way to close that window pane...

Link to comment
Share on other sites

The check box to control the Navigation Pane is under View -> Show. I suspect UIA should be able to find and flip that checkbox.

You can also control it via the registry though you'll have to restart Word to see the changes.

HKCU\SOFTWARE\Microsoft\Office\16.0\Word\Data\Toolbars

REG_BINARY has a lot data there. The location to flip it on or off is 000000AF. Setting it to 00 is off and 02 is on.

Coding those is outside of my time constraints at the moment but hopefully that'll get you started.

 

Edited by rsn
Link to comment
Share on other sites

#include <WindowsConstants.au3>
#include <SendMessage.au3>

$hWndWord = WinGetHandle("[CLASS:OpusApp]")
ConsoleWrite("$hWndWord=" & $hWndWord & @CRLF)

$hNavigation = ControlGetHandle($hWndWord, "", "[CLASS:MsoCommandBar; TEXT:Navigation]")
ConsoleWrite("$hNavigation=" & $hNavigation & @CRLF)

_SendMessage($hNavigation, $WM_CLOSE)

 

I know that I know nothing

Link to comment
Share on other sites

12 hours ago, ioa747 said:
#include <WindowsConstants.au3>
#include <SendMessage.au3>

$hWndWord = WinGetHandle("[CLASS:OpusApp]")
ConsoleWrite("$hWndWord=" & $hWndWord & @CRLF)

$hNavigation = ControlGetHandle($hWndWord, "", "[CLASS:MsoCommandBar; TEXT:Navigation]")
ConsoleWrite("$hNavigation=" & $hNavigation & @CRLF)

_SendMessage($hNavigation, $WM_CLOSE)

 

Genius!!!

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...