Jump to content

How to identify the controls in the Print dialog in MS Word?


Carol32
 Share

Recommended Posts

I want to launch MS Word, create a document, Save it, and then print it.

I have written a script, until launching the print dialog, however I am unable to proceed after that. How do I choose the specific printer in the dialog box, AutoIt Window Info does not show any information for the controls within the Print dialog box.

Also, I don't want to script using keyboard shortcuts, if I have to navigate to the Print option by using the control click commands, how do I do it.

 

Run ("C:Program FilesMicrosoft OfficeOffice12WINWORD.EXE")
WinWaitActive("Document1 - Microsoft Word")
Send("This is a test document to print")
Send("{F12}")
WinWaitActive("Save As")
Send("D:AutoitAutomationScripttest1")
Send("!s")
Send("^p")

Kindly advice, I am a newbie to automation and want to understand how to best use AutoIt.

Thanks

Link to comment
Share on other sites

Welcome to AutoIt and the forum!

AutoIt comes with an UDF (User Defined Functions Library) to interact with Word. Check the help file or try my enhanced Word UDF (for download see my signature).

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

Thanks MVP.

I have tried Word.au3. But my intention for wanting to use the print dialog is because I want to understand how to automate lists, buttons and other user controls. Using this know-how I want to proceed to automate testing custom created windows applications.

1) Why is the Autoit window not showing information for the list of printers available ?

2) Are there any restrictions on the identification of controls.?

3) Sample script that uses a lot of control identification.

Thanks

Link to comment
Share on other sites

Use the AutoIt Window Info tool to get the needed information (ControID, class ...) to automate the controls.

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

AutoIt can't automate all kinds of windows/controls.

If the Window Info Tool doesn't schow any content for the window/control then you can only use Send etc.

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