Quantcast
Channel: Adobe Community: Message List - InDesign Scripting
Viewing all articles
Browse latest Browse all 37788

Help in Applescript Mail option

$
0
0

Hi Forum,

 

I'm using tis applescript, to check the folder for files and sent mail via applescript.

 

It works quiet good. The problem is if the document does not contain any files, also the mail is sent to the receipient.

 

I'm requesting forum , to correct this applescript, to send the mail only if the files are found inside the folder.

 

 

 

onrun

          setmyFolderto "/Users/wander5/Desktop/QuarkRescueFolder"

          set {TID, text item delimiters} to {text item delimiters, linefeed}

          tellapplication "Finder" tosetmyFilestonameoffilesof (POSIX filemyFolderasalias)

          setnewNamestoparagraphsof (do shell script "sed 's/\\(.*\\)\\((.*)\\)/\\2 \\1/' <<< " & quoted formof (myFilesastext))

          repeatwithifrom 1 tocountmyFiles

                    tellapplication "System Events" tosetnameof (firstfileoffoldermyFolderwhosenameis (item 1 ofmyFiles)) to (item 1 ofnewNames)

          endrepeat

          settext item delimiterstoTID

 

          setfileListtolist foldermyFolderwithoutinvisibles

          repeatwithtFileinfileList

 

                    setrecipientNameto "Wander5"

                    setrecipientAddressto "Wander5@yahoo.com"

                    settheSubjectto "Please check Files has been completly copied from server"

                    settheContentto "check files have been copied"

 

                    tellapplication "Mail"

 

  # # Create the message

                              settheMessagetomakenewoutgoing messagewith properties {subject:theSubject, content:theContent, visible:true}

 

  ##Set a recipient

                              telltheMessage

  makenewto recipientwith properties {name:recipientName, address:recipientAddress}

 

  ##Send the Message

                                        send

 

                              endtell

                    endtell

  ##end tell

          endrepeat

endrun


 

 

Many thanks,


Viewing all articles
Browse latest Browse all 37788

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>