Hello!
I’m learning applescritpt & need help. My co=worker have a set a Photoshop actions that saves images in different file formats in the server. When she is processing images with Photoshop actions I want to know when a new jpg is proccessed. So I’m using a folder action add - new item alert.scpt for the folder containing the jpgs that will alert me new images has been placed & if I want to view the added images " yes" or “no”. This so far is OK but I would like to have more control but I don’t know how.
What I want if I click on button “yes” I want the finder to reveal the new items added & then I want Entourage 2004 version11.3.3 to save as a draft email listing the file names of new images added in the jpg folder. The reason why I want Entorage to save a draft email I can edit the email before is sent to another people in the dept & I don’t want to bombard with emails my co-workers for every jpg placed in that folder like example if 10 jpgs are received & then Entourage will send 10 emails for each jpg placed in that folder. If it best for every 5 jpgs send an email? Well that’s why I would love to hear from you; the experts
Please see the script & help with suggestions in how to approach this.
on adding folder items to this_folder after receiving added_items
try
tell application “Finder”
–get the name of the folder
set the folder_name to the name of this_folder
end tell
-- find out how many new items have been placed in the folder
set the item_count to the number of items in the added_items
--create the alert string
set alert_message to ("Folder Actions Alert:" & return & return) as Unicode text
if the item_count is greater than 1 then
set alert_message to alert_message & (the item_count as text) & " new items have "
else
set alert_message to alert_message & "One new item has "
end if
set alert_message to alert_message & "been placed in folder " & «data utxt201C» & the folder_name & «data utxt201D» & "."
set the alert_message to (the alert_message & return & return & "Would you like to view the added items?")
display dialog the alert_message buttons {"Yes", "No"} default button 2 with icon 1 giving up after dialog_timeout
set the user_choice to the button returned of the result
if user_choice is "Yes" then
tell application "Finder"
--go to the desktop
activate
--open the folder
open this_folder
--select the items
reveal the added_items
set sort column of list view options of Finder window 1 to modification date column
end tell
end if
if user_choice is "Yes" then
tell application "Microsoft Entourage"
activate
set themessage to make new outgoing message with properties {recipient:"nellbern@bellsouth.net", subject:"New images added to
IT-Web folder", content:“Go to the following folders: IT-web> jpg”}
repeat with i from 1 to item_count
make new attachment at themessage with properties {file:(item i of added_items)}
end repeat
set messID to the result
send messID
end tell
end if
end try
end adding folder items to