Jump to content
Sign in to follow this  
Carol32

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

Recommended Posts

Carol32

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
markyrocks

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
water

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 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Carol32

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
water

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 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Carol32

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
water

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 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
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  

×