Hello
I made a bit of cleaning and now the script adjust itself to the language in use.
property theLargePagePrinter : "HP Officejet Pro 8610"
tell application "Finder" to set Print_loc to localized string "N167" set All_loc to 1 --"All" / "Tout" set Size_loc to 1 --"Size" / "Taille" set ActualSize_loc to 2 --"Actual size" / "Taille réelle" set ShrinkOversizedPages_loc to 3 -- "Shrink oversized pages" / "Réduire les pages hors format"
--tell application "Adobe Acrobat Reader DC" to activate
tell application "System Events" to tell process "AdobeReader" set frontmost to true --do shell script ("sleep 0.2") try keystroke "p" using command down end try
repeat if exists (first window whose subrole is "AXDialog" and name is Print_loc) then exit repeat do shell script ("sleep 0.1") end repeat
tell group 1 of window Print_loc try click pop up button 1 end try
repeat 20 times do shell script ("sleep 0.1") if exists menu 1 of pop up button 1 then exit repeat end repeat
try click menu item (my theLargePagePrinter) of menu 1 of pop up button 1 end try --do shell script ("sleep 0.2") end tell
try click radio button All_loc of group 2 of window Print_loc end try
tell group 3 of window Print_loc try click checkbox Size_loc end try do shell script ("sleep 0.2") try (* try say 1 say (exists (radio button ShrinkOversizedPages_loc)) as text --< "true" end try
try say 2 try (get every attribute of radio button 3) as text -- Issue an error because the coercion can't be done on error errMsg set {oTIDs, AppleScript's text item delimiters} to {AppleScript's text item delimiters, {"{", "}"}} set maybe to item 2 of (text items of errMsg) set AppleScript's text item delimiters to oTIDs end try tell application "SystemUIServer" to display dialog maybe as text say 3 end try *) if value of radio button 2 = 0 then # The button is not selected. # Probably an Adobe oddity, we must put the focus on it. set value of attribute "AXFocused" of radio button 2 to true # before clicking it click radio button 2 (* perform action "AXPress" of radio button 2 # Alternate syntax *) end if end try do shell script ("sleep 0.2") end tell -- < more code> end tell --end tell
#=====
I disabled several instructions which where useful for tests but are no longer needed.
Yvan KOENIG (VALLAURIS, France) vendredi 10 juillet 2015 19:37:13
|