I am a complete novice with this. I have been posting to apple’s applescript forum and gotten some good help, but I found this and figured I would try here too. In a nutshell this is what i am trying to do, we print files out of indesign and quark xpress, the files go through our workflow and place a PDF in a folder when it is done. The PDF has the same name as the file that created it, just a different extension. I want to move the pdf to the same location as the native file. so when a PDF is placed in the folder on the server, i want it to tigger a search for the same file name minus the extention, and move the pdf to that location. i am using an 10.4.5 xserve… here is a script someone wrote to help me out, but it is not working and i don’t know enough to figure it out.
on adding folder items to this_folder after receiving these_items
set Quark_ext to "qxp" -- change this to actual Quark extension
set InDesign_ext to "indd" -- change this to actual InDesign extension
set server_path to "Raid:Production"
repeat with _item in these_items -- loop thru multiple dropped items
tell application "Finder"
set AppleScript's text item delimiters to {""}
set _name to name of _item -- name with ext
set name_extension to name extension of _item -- extension, that would be PDF
set AppleScript's text item delimiters to {("." & name_extension)}
set _name to text item 1 of _name -- name without ext
set AppleScript's text item delimiters to {""}
end tell
-- search for same name with Quark ext
set search_server to my find_file(_name, Quark_ext, server_path)
-- search for same name with InDesign ext
if search_server is "" then my find_file(_name, InDesign_ext, server_path)
-- nothing found, exit
if search_server is "" then return
tell application "Finder"
-- get server folder
set server_folder to container of (POSIX file of search_server)
duplicate _item to server_folder
end tell
end repeat
end adding folder items to
on find_file(file_name, file_ext, server_path)
-- find file using mdfind, this should be faster than Finder
-- server volume's items' meta dat should be indexed
set found_file to do shell script "/usr/bin/mdfind '" & file_name & space & file_ext & "' -onlyin " & quoted form of POSIX path of server_path
return found_file
end find_file
i made the script and attached it to a folder and nothing happens, any help would be great!
thanks in advanvce
Frank
Model: xserve
AppleScript: 1.10.3
Browser: Safari 417.8
Operating System: Mac OS X (10.4)