Hello everyone,
I aplogize if this question has been asked before, because it seems like it is something that would be, but the search didn’t turn anything up. I am trying to write and applescript inside automator to convert jpg files to .pdf files.
I am new to Applescript and the Mac in general, but I know some VB and python coding. I have not sat down to learn applescript yet, so I am sort of doing this off the cuff from my VB and python knowledge. What I am trying to do with this automator action is sort scanned jpg files, batch convert them to .pdf and then combine them to a single .pdf document. The scanner I am using is rather old so it only scans images one at a time into .jpg files.
My code is rather guesswork, but I tried to base it off of what I saw in the sample script on my Mac and in a different automator action over at autmoator world that used Fink or something instead of the Mac conversion system. Chances are I am missing something huge in the script. It executes without error, but I am not getting my outupt so I am stuck there.
Any help would be great as I am not 100% how the IDs are defined or even passed through automator actions. As of note, before this action in automator I have a “sort finder items by ascending order”. Afterwords I plan to have a combine PDF action.
property type_list : {"JPEG", "GIFf", "PICT", "TIFF", "PDF", "TEXT"}
property extension_list : {"jpg", "gif", "pct", "tif", "pdf", "rtf"}
on run {input, parameters}
try
repeat with i from 1 to the count of input
set theFilePath to (this_item as string)
set this_item to (item i of input) as alias
set orgFileName to POSIX path of this_item
set terminalCommand to ""
set convertCommand to "/System/Library/Printers/Libraries/./convert"
set newFileName to orgFileName & ".pdf"
set terminalCommand to convertCommand & "-f " & "\"" & orgFileName & "\"" & " -o " & "\"" & newFileName & "\"" & " -j \"application/pdf\""
do shell script terminalCommand
end repeat
return input
end try
end run
Model: Macbook
Browser: Safari 419.3
Operating System: Mac OS X (10.4)