|
|
#1 |
|
Prospect
Join Date: Nov 2007
Posts: 15
|
Show Page Setup dialog in Applescript
How does one force a page setup dialog in Applescript assuming the active application is Finder? What about in BBedit. What I really want to do is print a document in landscape mode with a 75% reduction in size. I cannot find the proper syntax in the dictionary.
tell application "finder" print document end tell Thanks for any help Douglas McKibbin |
|
|
|
|
|
#2 |
|
Hall of Famer
Join Date: Apr 2007
Posts: 3,342
|
the finder is not a document-based app (it's meant to work with files and folders), and so it doesn't have many sophisticated printing features on its own. the way to do this is to open the file in an application that is designed to handle documents, and script that. what kind of file is this, and why are you wanting to print it from the Finder?
__________________
Philosophy is a battle against the bewitchment of our intelligence by means of language. -LW- |
|
|
|
|
|
#3 |
|
Prospect
Join Date: Nov 2007
Posts: 15
|
Thanks,
This is a text file. I can use BBedit to add properties to the print command but I still cannot get the syntax right to either display the page setup or print dialogs even in BBedit. Ideally I would just like to print the document in landscape mode from BBedit and not have to choose landscape mode from the page setup dialog. |
|
|
|
|
|
#4 |
|
League Commissioner
Join Date: Jan 2005
Posts: 8,363
|
This will get you started...
I haven't figured out how to click the orientation.
![]() Code:
tell application "TextEdit"
activate
tell application "System Events" to tell process "TextEdit"
keystroke "p" using {command down, shift down}
delay 0.2
keystroke "75"
end tell
end tell
|
|
|
|
|
|
#5 |
|
League Commissioner
Join Date: Jan 2005
Posts: 8,363
|
This seems to work:
GUI scripting is no fun because it's easy to get ahead of the application, but I think I've got enough delays to avoid problems.
Code:
tell application "TextEdit"
activate
tell application "System Events" to tell process "TextEdit"
keystroke "p" using {command down, shift down}
delay 0.5
keystroke "075"
delay 0.5
keystroke tab
keystroke tab
keystroke tab
key code 124 -- right arrow to landscape 1st option
key code 124 -- right arrow to landscape 2nd option
end tell
end tell
|
|
|
|
|
|
#6 |
|
Prospect
Join Date: Nov 2007
Posts: 15
|
thanks. The following script works for Page Setup and Print....
tell application "TextEdit" activate open {file (filepath)} tell application "System Events" to tell process "TextEdit" keystroke "p" using {command down, shift down} delay 1 keystroke "075" delay 1 keystroke tab keystroke tab keystroke tab key code 124 -- right arrow to landscape 1st option key code 124 -- right arrow to landscape 2nd option key code 36 delay 1 keystroke "p" using {command down} delay 2 key code 36 delay 4 keystroke "w" using {command down} end tell quit end tell |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|