Jump to content

Check state of word checkbox


Recommended Posts

Hi There,

 

I'm busy automating a proces in Word. the problem is that some of our users don't have the same checkboxes on or off in their environment.

I'm using word 2010 and word 2013.

When a word document is saved as a PDF document, sometimes the checkbox : "open file after publishing" is checked (so the PDF opens in Adobe)

Does anyone know a way how to read the state of a checkbox in a word window?

 

Link to comment
Share on other sites

Do you automate the saving of the word docoument as PDF?

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

This works for me in Word 2013:

$isChecked = ControlCommand("[CLASS:#32770]", "", "[CLASS:Button; INSTANCE:4]", "IsChecked"))

Don't know if the window class and checkbox control class are always the same, you'll have to check that for yourself.
Apart from that, there's a great Word UDF around. Look at the _Word* functions. _Word_DocSaveAs and _Word_Export seem interesting. I have never used it myself because I have a schijthekel aan MS Office, but it may be much less of a hassle using that precooked functionality for this automation project?

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

That was the reason for asking. It is much better and reliable to use the Word UDF and automate Word via COM than automating the GUI (as long as the methods and properties are exposed for COM).

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

If that does not work you can also reset all user word's profil like this:

Reg delet : HKEY_CURRENT_USER\Software\Microsoft\Office\<Your office version>\Word\Data

after a new run of word it will make it again ... yeah it s a bit brutal but this gonna work xD

 

if you are able to code complicated reg thing you can also save this key then delet it and then restore the key... that whould be also a solution.

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - 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

 

Link to comment
Share on other sites

Thanks for the answers.

I think I have a old word.au3 (there is no _Word_Export function). The _Word_DocSaveAs doesn't seem to have the option to save as PDF.
@water: can you tell me please where i can find the latest version? 

@SadBunny: I tried to check the button with this command, but it doesn't seem to work. 

$isChecked=ControlCommand("[CLASS:#32770]", "", "[CLASS:Button; INSTANCE:1]", "Check","") 

also if the button is checked, the $isChecked=0 if I use:

$isChecked=ControlCommand("[CLASS:#32770]", "", "[CLASS:Button; INSTANCE:1]", "IsChecked","")

Link to comment
Share on other sites

The Word UDF comes with AutoIt. If you run 3.3.12.0 then you have the latest version of the UDF.

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

BTW: The name of the function is _Word_DocExport.

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

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

×
×
  • Create New...