I am am trying to turn off two sided printing. If I print from Excel it is off but when I use the following script if defaults to printing both sides. Could not find anything in the dictionary
[appleScript]
tell application “Microsoft Excel”
tell page setup object of active sheet
set page orientation to landscape
set zoom to flase
set fit to pages wide to 1
set fit to pages tall to 10
set center header to “&20” & “&A” & return & “&F” --Set Font Size Worksheet & WorkBook Name on 2 lines
set left header to “&15” & "On " & “&d” & " @ " & “&t” --Date & Time
–set right header to “&d” & " " & “&t”
set center horizontally to true
set center vertically to true
set print gridlines to true
end tell
print out used range of active sheet
end tell
[/appleScript]
Any suggestions appreciated
thanks Peter
Double-sided printing is a function of each user’s specific printer. It isn’t available for manipulation in Excel’s object model.
Thanks for that however I was hoping I could use AppleScript to get to my printer. The following script is a start but I cannot figure out how to get to the drop down box it produces. Any thoughts
[appleScript]
tell application “System Events”
tell process “Microsoft Excel”
click pop up button 4 of window “Print”
end tell
end tell
[/appleScript]
Peter
Sorry not thinking I need to use key code’s to move and select the necessary option. will try that and hopefully will work.
thanks again
Got it working more complicated than I thought, thanks again. Just in case anyone is interested and if their is a simpler way, this is my working code.
[appleScript]
tell application “System Events”
tell process “Microsoft Excel”
click menu item “Print…” of menu 1 of menu bar item “File” of menu bar 1
click pop up button 4 of window “Print”
set Check to value of result as string
set CodeN to 125 --Down 1
repeat 2 times --Down First then UP
repeat 7 times–The # of possibilities
if Check = “Layout” then
key code 36
exit repeat
else
key code CodeN
delay 1
key code 36
click pop up button 4 of window “Print”
set Check to value of result as string
delay 1
end if
end repeat
if Check = “Layout” then exit repeat
set CodeN to 126 --Up 1 step in drop down box
end repeat
delay 2
set CodeN to 125 --Down 1 step in drop down box
repeat 2 times --Make sure 2 sided is off
repeat 4 times–The # of possibilities
if Check = “Off” then
key code 36
exit repeat
else
key code CodeN
delay 1
key code 36
click pop up button 7 of window “Print”
set Check to value of result as string
end if
end repeat
if Check = “Off” then exit repeat
set CodeN to 126
end repeat
delay 1
key code 36 --Prints Result as the Print Button Selected @ end Previous Step. Excel must be activated not just open
end tell
end tell
Peter