Hi all,
I have a script here that compares two folders, and finds any new images in those folders. It displays a dialog box with the results. I’d like a button that asks you if you want to email the results. If I click yes, I’d like the results to be emailed as plain text to a specified email address. I don’t want it to ask me for the email addy (that can be stored in the script, as it will never change). There will be two seperate email addresses it will go to, so I need that to be an option as well. Is this ‘do-able’ ?
Thanks for your help, here is the script I have so far.
set oldFolder to choose folder with prompt "Choose CLEAN folder:" --default location alias "MacintoshHD:Users:jmhaynes:Desktop:imagesTest:"
set newFolder to choose folder with prompt "Choose FINAL folder:" --default location alias "MacintoshHD:Users:jmhaynes:Desktop:imagesTest:"
tell application "Finder"
set Final_imag_folders to folders of (entire contents of newFolder) whose name is "images" --all folders "images" of folder "...p01FINAL_f"
set New_image_text to ""
repeat with this_folder in Final_imag_folders
set ThisName to name of parent of this_folder as string -- ex: the result -> "T205p02FINAL"
set Name_Of_Page to my replace_chars(ThisName, "FINAL", "CLEAN") -- ex: change string "T205p02FINAL", the result-> "T205p02CLEAN"
if exists folder Name_Of_Page of oldFolder then --ex :check if exists folder "T205p02CLEAN" in folder "...p01CLEAN_f"
set clean_images to name of (files of (entire contents of folder Name_Of_Page of oldFolder) whose name of parent is "images")
--ex: clean_images is name of the images of folder "images" of folder "...p01CLEAN_f"
set Final_images to (files of (entire contents of this_folder) whose name is in clean_images)
delete Final_images -- ex :delete images in folder "images" of folder "...p01FINAL_f" ,no problem if Final_images is empty
end if
set New_image_text to New_image_text & "There are " & (count files of this_folder) & " NEW images in " & name of parent of this_folder & return
if count files of this_folder is less than 1 then delete folder this_folder -- ADDED SEPT 1, 2005 BY JAMES WILKINSON to delete the folder if no images are contained
end repeat
end tell
display dialog New_image_text
on replace_chars(this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars