Jump to content

Script to watch for Winword 2010 then click a toolbar/ribbon button


Recommended Posts

Hi, my brain is absolutely swimming and I'm having no luck trying to get my head around AutoIt and VBA macros at the same time.

I need AutoIt to detect when a/any file opens in MS Word 2010 opens and when it does, to click a button on the Word toolbar (that will run a macro that makes some changes to make the file compliant, saves the file and closes word).

I have the Word macro done and tested.  I plan to open a list of files in word using a simple DOS batch file.  I've had no luck making AutoOpen work in Word macros, so I'm hoping Openit can help me out.

I've not been able to work out how to make AutoIt to detect word has opened a file (as opposed to opened to just Document 1), or how to click the right bits of the toolbar.  Worst case scenario I can use the location of the button and make sure Word always opens full screen.  I think I can do that, but as I'm failing the other bits I'm not sure if I'm reading the data in the AutiIt window info either.

So, to the experts. I'd like a script to detect that Word has opened a file, bring up the View toolbar, then click the button to trigger the macro.  The batch file will then open the next file, repeat.

Please help.  Thanks

 

Link to comment
Share on other sites

Welcome to Autoit and the forum!

I would do the following:

  • Check why the macro isn't being executed when the document is opened. There are lots of sites exactly describing how to to this (like this one).
  • I suggest to use the Word UDF that comes with AutoIt if you need to automate Word from an external program
Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

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