Folder Actions on a Server
Folder Actions on a Server
- Subject: Folder Actions on a Server
- From: Steven Halford <email@hidden>
- Date: Thu, 03 Nov 2005 09:45:35 +0000
- Thread-topic: Folder Actions on a Server
Hi All,
I have written the following script to check for images that are saved
incorrectly to our image folders on our server. It checks for resolution and
if the image is RGB or CMYK, and displays an alert if something is amiss.
I now have three questions -
1) Ideally I would like the Folder Action attached to the folders from all
our macs and only display the alerts on the computer of the person that
copied the image there. As it is, everyone would be notified. Is there a way
to check where the image originated from and then only display alerts on
that computer?
2) At the moment, whenever an image is placed in these folders, whether it
needs attention or not, the computer that is running the Folder Action
script will momentarily flash to the Finder and then back to the program
that was being used. Is there a way to let the script run in the background
and only interrupt work if it needs to display an alert? If I take "launch"
out of the Image Events tell block, nothing happens.
3) As far as I can tell, if an image in these folders is replaced the script
doesn't check the updated image. It will only check the image if it is a
brand new one. Is there a way to work around this?
Any help or advice will be appreciated,
Regards,
Steve
---- THE SCRIPT -------
on adding folder items to this_folder after receiving these_items
repeat with i from 1 to number of items in these_items
set this_item to item i of these_items
tell application "Finder"
set theFileName to the name of this_item
end tell
tell application "Image Events"
launch
set this_image to open this_item
set theCSpace to the color space of this_image
copy the resolution of this_image to {xres, yres}
close this_image
end tell
set theCSpaceString to theCSpace as string
if theCSpaceString does not contain "CMYK" and xres is less than 250
then
my alertNumpty(theFileName, "both")
end if
if theCSpaceString does not contain "CMYK" and xres is greater than
250 then
my alertNumpty(theFileName, "rgb")
end if
if xres is less than 250 and theCSpaceString contains "CMYK" then
my alertNumpty(theFileName, "res")
end if
set this_item to ""
set this_image to ""
set theCSpace to ""
end repeat
end adding folder items to
on alertNumpty(theFileName, theReason)
if theReason is equal to "rgb" then
tell application "Finder"
--activate
beep
display dialog "The image " & theFileName & " has been saved as
RGB, no RGB images should be saved in this folder."
end tell
else if theReason is equal to "res" then
tell application "Finder"
--activate
beep
display dialog "The resolution of the image, " & theFileName & "
is less than 250 pixels/inch. Images should be saved at 300 pixels/inch."
end tell
else if theReason is equal to "both" then
tell application "Finder"
--activate
beep
display dialog "The image " & theFileName & " has been saved as
RGB and it the resolution is less than 250 pixels/inch. Sort it out!!"
end tell
end if
end alertNumpty
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden