Le 10/07/2015 à 06:55, Brian Christmas < email@hidden> a écrit :
Hello Brian
I don't own Adobe Acrobat so I tested with Adobe Reader using this awful code which works
property theLargePagePrinter : "HP Officejet Pro 8610"
set french to true if french then set windowName to "Imprimer" set All_loc to "Tout" set Size_loc to "Taille" set ShrinkOversizedPages_loc to "Réduire les pages hors format" set ActualSize_loc to "Taille réelle" else set windowName to "Print" set All_loc to "All" set Size_loc to "Size" set ShrinkOversizedPages_loc to "Shrink oversized pages" set ActualSize_loc to "Actual size" end if
--tell application "Adobe Acrobat Reader DC" to activate do shell script ("sleep 0.2") 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 --do shell script ("sleep 0.2") repeat if exists (first window whose subrole is "AXDialog" and name is windowName) then exit repeat do shell script ("sleep 0.1") end repeat try click pop up button 1 of group 1 of window windowName end try set x to 0 repeat until exists menu 1 of pop up button 1 of group 1 of window windowName do shell script ("sleep 0.1") set x to x + 1 if x ≥ 20 then exit repeat # wait 2 seconds end repeat do shell script ("sleep 0.2") try click menu item (my theLargePagePrinter) of menu 1 of pop up button 1 of group 1 of window windowName end try do shell script ("sleep 0.2") try click radio button All_loc of group 2 of window windowName end try try click checkbox Size_loc of group 3 of window windowName end try do shell script ("sleep 0.2") try try say 1 say (exists (radio button ShrinkOversizedPages_loc of group 3 of window windowName)) as text --< "true" end try
try say 2 set maybe to (get every attribute of radio button 3 of group 3 of window windowName) try maybe as text -- Issue an error because the coercion can't be done on error errMsg set maybe to item 2 of my decoupe(errMsg, {"{", "}"}) end try tell application "SystemUIServer" to display dialog maybe as text -- < fails say 3 end try
set radioValue2 to value of radio button 2 of group 3 of window windowName
if radioValue2 = 0 then set value of attribute "AXFocused" of radio button 2 of group 3 of window windowName to true click radio button 2 of group 3 of window windowName end if end try do shell script ("sleep 0.2") try -- click radio button ActualSize_loc of group 3 of window windowName end try -- < more code> end tell --end tell
#=====
on decoupe(t, d) local oTIDs, l set {oTIDs, AppleScript's text item delimiters} to {AppleScript's text item delimiters, d} set l to text items of t set AppleScript's text item delimiters to oTIDs return l end decoupe
#=====
Yvan KOENIG (VALLAURIS, France) vendredi 10 juillet 2015 17:17:56
|