Choose file ...of type problem

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





does this work?

of type {"com.microsoft.word.doc"}

Yes that does. Thanks for the help. That was really driving me crazy…

just RTFD(ictionary)

of type optional list of unicode text a list of file types or type identifiers. Only files of the specified types will be selectable.

:wink:

Ok what does RTFD(ictionary) mean?
I assume referred to the dictionary?

My problem was that first i’m not sure what a type identifier was and second i couldn’t find a list of what to the call the file type. Finder’s get info was where i came up with some of the guesses.

sorry, I was kidding and I admit that I assumed too much.

you can gather the type identifier of a file with


display dialog (type identifier of (info for (choose file)))

RTFD is derivated from RTFM :wink:

:lol: Not a problem. I was wondering if that was what the f was for.

fantastic, what else? :cool: