Re: Print word document to PDF
Re: Print word document to PDF
- Subject: Re: Print word document to PDF
- From: Jeremy Sellors <email@hidden>
- Date: Fri, 15 Jun 2007 20:22:11 -0700
This works in my case for TextEdit for—Mail PDF—PDF Services and
should be the same for Word and —Save as PDF…
You could add:
delay 3
keystroke (ASCII character 3) -- enter key
at the end of the try block to save using the documents name.
Unfortunately I do not have Word for OS X so I cannot test it.
activate application "TextEdit"
tell application "System Events"
get system attribute "sysv"
if result is greater than or equal to 4144 then -- Mac OS X 10.3.0
if UI elements enabled then
tell application process "TextEdit"
-- insert GUI Scripting statements here
click menu item "Print…" of menu 1 of menu bar item "File" of
menu bar 1
try
tell UI element 1 of UI element 5 of UI element 4 of sheet
"Print" of window 1
set {xPosition, yPosition} to position
set {xSize, ySize} to size
end tell
-- modify offsets if hot spot is not centered:
click at {xPosition + (xSize div 2), yPosition + (ySize div 2)}
repeat 7 times --set to the number in the PDF drop down list of
the desired PDF Service e.g. Save as PDF… is 1
keystroke (ASCII character 31) -- down arrow key
end repeat
keystroke (ASCII character 3) -- enter key
end try
select UI element 1 of UI element 5 of UI element 4 of sheet
"Print" of window 1
end tell
else
beep
display dialog "GUI Scripting is not enabled" & return & return &
"Open System Preferences and check Enable Access for Assistive
Devices in the Universal Access preference pane, then run this script
again." with icon stop
if button returned of result is "OK" then
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.universalaccess"
end tell
end if
end if
else
beep
display dialog "This computer cannot run this script" & return &
return & "The script uses GUI Scripting technology, which requires an
upgrade to Mac OS X 10.3 Panther or newer." with icon caution buttons
{"Quit"} default button "Quit"
end if
end tell
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden