Yvan,
Here is an example from clicking on a checkbox in the Mail Preferences window.
tell application "System Events" to tell process "Mail"
set frontmost to true
keystroke "," using command down -- open "Preferences" window
repeat until exists window 1
end repeat
tell window 1
click button 1 of toolbar 1 -- make sure first tab active
tell group 1 of group 1
if value of checkbox 1 = 1 then -- [0 unchecked, 1 checked] -- "Play sounds for other mail actions" checkbox in English version
click checkbox 1
end if
end tell
end tell
end tell
Generally I tend to use a variable set to the value of the checkbox that I would like and then just compare against that value to cover off either case, eg.
set playSoundsChkBx to 1
set playSoundsChkBxValue to 0
then in the code:
if value of checkbox playSoundsChkBx ≠ playSoundsChkBxValue then
click checkbox playSoundsChkBx
end if
====================================
So in your case it looks like the statement should be:
if value of checkbox 2 = 0 then
click checkbox 2
end if
Hope this helps.
David
On Aug 20, 2016, at 7:23 AM, Yvan KOENIG <email@hidden> wrote:
Hello, not so common event, today I ask a question.
An user asked me for a script exporting more than 10,000 AppleWorks documents as PDF files.
I have a script doing the job but as it requires the application AppleWorks, it must run on an old machine which is really slow.
As LibreOffice is able to open the AppleWorks file, I'm working upon a code doing the job with this free app running on modern machines.
I have a working script but I'm not satisfied by a detail : when I must click in a checkbox I found no other tip than using the brave old cliclick.
I publish the script here hoping that some of you ( maybe Bill Cheeseman )will be able to find a neater scheme.