Folder Actions Behavior
Folder Actions Behavior
- Subject: Folder Actions Behavior
- From: Eric Schult <email@hidden>
- Date: Wed, 25 Jul 2001 13:38:40 -0500
I'm using Folder Actions and Folder Actions Plus, but I'm a little bit
stumped by the behavior I'm getting.
I've attached a Folder Action script to several EPS folders on a network
volume so that when a folder item is added to any one of the EPS folders
(whether or not the folder is open in the Finder) the script launches. If
the new folder item is an EPS, it's copied to a Distiller hot folder for PDF
conversion.
The script works fine if I add the EPSes from my Mac (where the Folder
Actions script resides). However, when a remote computer adds the item, the
script doesn't launch. I'd thought the copying of an EPS from any location
would trigger the Folder Action, but apparently it's the (local) action of
copying to the attached folder that's the trigger, not the (remote) physical
addition of a new item that does the trick. (A rather fine distinction, if
you ask me.)
Can anyone suggest an alternative that would do what I want? My script
follows, hopefully without scrambling the line breaks.
Appriciatively,
wes
property pdfInFolder : "Path_to_PDFs:In:"
property pdfOutFolder : "Path_to_PDFs:Out:"
property displayDialogs : true
property dialogDuration : 2
on adding folder items to myFolder after receiving newItems
beep 2
repeat with i in newItems
tell application "Finder"
if file type of i is "EPSP" or file type of i is "EPSF" then
try
set pdfName to trim ".eps" off name of i from back side
-- requires Acme Script Widgets
set pdfName to pdfName & ".pdf" as string
on error
set pdfName to ((name of i) & ".pdf" as string)
end try
if (exists (file (pdfOutFolder & pdfName))) true then
if displayDialogs is true then
activate
display dialog "Copying EPS file \"" & name of i & ,
"\" to folder \"" & name of folder pdfInFolder & ,
"\" ..." with icon note giving up after dialogDuration
end if
try
copy i to folder pdfInFolder
end try
else
if displayDialogs is true then
activate
display dialog "EPS file \"" & name of i & ,
" is already present in folder \"" & name of folder pdfInFolder & ,
"\"." with icon note giving up after dialogDuration
end if
end if
end if
end tell
end repeat
end adding folder items to