I am running an applescript application
using stay open
option.
Function of the script is:
- the applescript will ask for "javascript" to run the below is my code. the functions of the javascript is to find a files & folders inside the folders and then copy and paste into other path, which is defined inside the script.
- after copying mail, the email will be send to the person, saying "please check the file".
But, what happens is, each and every time the applescript send the mail to the receipient.
My need is to send email only when the folder has some items inside in it and always.
Below is my code:
property pathToScript : ""
on idle
if pathToScript is "" then set pathToScript to (choose file with prompt "Please choose the Javascriptfile") as text
tell application "Adobe InDesign CS5.5"
do script pathToScript language javascript
end tell
##sending mail after the "javascript" is complete"
set recipientName to "Rajni Kanth"
set recipientAddress to "[email protected]"
set theSubject to "Please check Files has been completly copied from server"
set theContent to "check files have been copied"
tell application "Mail"
# # Create the message
set theMessage to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true}
##Set a recipient
tell theMessage
make new to recipient with properties {name:recipientName, address:recipientAddress}
##Send the Message
send
end tell
end tell
return 0
end idle