Convert to PDF

I'm working on a Hazel action that will watch a folder and, if a file appears, will convert it to a PDF and delete the original. The conditions are simple: if Name is not blank, run this embedded AppleScript:
However, even with a simple .txt file, this rule comes back with a failure. Can anyone tell me why?
- Code: Select all
set _list to {"txt", "doc", "docx", "xls", "xlsx", "ppt", "pptx"}
tell application "Finder"
set _path to POSIX path of file theFile
set _name to name of file theFile
set _ext to name extension of _info
set _info to info for theFile
end tell
if _list contains _ext then
set _inputFile to _path & _name & "." & _ext
set _outputFile to _path & _name & ".pdf"
do shell script "/System/Library/Printers/Libraries/convert -f " & quoted form of _inputFile & " -o " & quoted form of _outputFile
delete _inputFile
end if
However, even with a simple .txt file, this rule comes back with a failure. Can anyone tell me why?