Ok, this is driving me crazy. The script below works fine. However, I wanted to restrict it to Word docs originally. I cannot figure out how to put in
of type ["Microsoft Word"]
. i’ve tried “Microsoft Word”, “Microsoft Word 97- 2004 document” “Microsoft Word Document”, “.doc”. Help please.
thanks.
(*
Create PDFs from Word
Credit to macadmin at macstuff.beachdogs.org for the printer utility code.
*)
global the_printer
--Choose Folder and sort view
set CFolder to (choose folder with prompt "What folder would you like to work in?")
tell application "Finder"
activate
open CFolder
get name of Finder window 1
set winRef to Finder window 1
select winRef
set current view of winRef to list view
set sort column of list view options of Finder window 1 to modification date column
delay 2
close winRef
end tell
-- change default printer
tell application "Printer Setup Utility"
set the_printer to the current printer
set the_name to the name of the_printer
if the_name is not "CUPS-PDF" then
set the_count to the count of printers
repeat with x from 1 to the_count
if the name of printer x is "CUPS-PDF" then
set the current printer to printer x
end if
end repeat
end if
quit
end tell
-- choose files in folder to be printed to pdf
set cFiles to (choose file with prompt "What file(s) would you like to convert to PDF. You may select multiple files." default location CFolder with multiple selections allowed)
tell application "Microsoft Word"
activate
repeat with i from 1 to number of items in cFiles
set this_item to item i of cFiles
print this_item without print dialog
end repeat
tell application "Printer Setup Utility"
set the current printer to the_printer
quit
end tell
tell application "Finder"
activate
make new Finder window to folder "cups-pdf" of (path to desktop)
end tell
end tell