Sign in to follow this  
Followers 0
Carol32

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

7 posts in this topic

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

Share this post


Link to post
Share on other sites



I'd try setting up the proper printer as default in your computer. That way you avoid that step completely. Just my 2c

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I used the AutoIt window info tool.. however for the print dialog, it shows no information. I want to know why that happens.

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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