Applescript to change file type using fol…
Imported from the Apple Support Forums via the Wayback Machine 🔗
Just found out my Adobe Acrobat is saving PDFs with the filetype "FDP" and creator "ORAC" which is obviously the reverse of what they should be.
There doesn't appear to be a fix for this, and for me it's a problem because when I copy these PDFs onto our Xinet WebNative asset management server the files aren't recognised as PDFs, so don't display a preview in the web page.
So, I wanted to use a folder action that will set the Creator and Type to the PDFs whenever they are put into a folder on the server.
Unfurtunately, although I can get this to work when using a script in the form of an application (so I drop PDFs onto it, I cannot get it to work as a folder action. It doesn't set the creator and type even though the same commands in a application script do work.
*This is the code to my script which works fine as an application:*
====================
property FileType : ""
property CreatorType : ""
on open theFiles
tell application "Finder"
activate
set FileType to "PDF "
set CreatorType to "CARO"
repeat with eachFile in theFiles
set the file type of eachFile to FileType
set the creator type of eachFile to CreatorType
end repeat
end tell
end open
===================
*and this is what I'm trying to use for a folder action:*
===================
on adding folder items to my_folder after receiving the_files
set pdfs to {"pdf"}
repeat with i from 1 to number of items in the_files
tell application "Finder"
set this_file to (item i of the_files)
set the file_path to the quoted form of the POSIX path of this_file
--set the file_path2 to the quoted form of file_path --can combine if file_path isn't needed
set this_fileType to name extension of (info for this_file)
end tell
if this_fileType is in pdfs then
tell application "Finder"
activate
set FileType to "PDF "
set CreatorType to "CARO"
end tell
end if
end repeat
end adding folder items to
==================
I know it processes the file but it doesn't actually change the creator type.
*If only Apple would fix this bug in the first place!*
5 replies
Sign in or join Beachball Help to reply.
- 0
- 0
- 0
- 0
- 0