Help in Applescript Mail option

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.
on run
          set myFolder to "/Users/wander5/Desktop/QuarkRescueFolder"
          set {TID, text item delimiters} to {text item delimiters, linefeed}
          tell application "Finder" to set myFiles to name of files of (POSIX file myFolder as alias)
          set newNames to paragraphs of (do shell script "sed 's/\\(.*\\)\\((.*)\\)/\\2 \\1/' <<< " & quoted form of (myFiles as text))
          repeat with i from 1 to count myFiles
                    tell application "System Events" to set name of (first file of folder myFolder whose name is (item 1 of myFiles)) to (item 1 of newNames)
          end repeat
          set text item delimiters to TID
          set fileList to list folder myFolder without invisibles
          repeat with tFile in fileList
                    set recipientName to "Wander5"
                    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
  ##end tell
          end repeat
end run
Many thanks,

I didn't test but don't you just need to test fileList's length/count before you loop the list…?
on run
          set myFolder to "/Users/wander5/Desktop/QuarkRescueFolder"
          set {TID, text item delimiters} to {text item delimiters, linefeed}
          tell application "Finder" to set myFiles to name of files of (POSIX file myFolder as alias)
          set newNames to paragraphs of (do shell script "sed 's/\\(.*\\)\\((.*)\\)/\\2 \\1/' <<< " & quoted form of (myFiles as text))
          repeat with i from 1 to count myFiles
                    tell application "System Events" to set name of (first file of folder myFolder whose name is (item 1 of myFiles)) to (item 1 of newNames)
          end repeat
          set text item delimiters to TID
          set fileList to list folder myFolder without invisibles
          if length of fileList > 0 then -- Its not an empty list…
                    repeat with tFile in fileList
                              set recipientName to "Wander5"
                              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
                    end repeat
          end if
end run

Similar Messages

  • Need help to share Number/Pages file visa Mail option. Cannot do with iPad Air (iOS7)

    Need help to share Number/Pages file visa Mail option. Cannot do with iPad Air

    Oh, okay. After selecting the format I want to send, it says "creating... ". Then irrespective of the format I choose the message e.g. "creating spreadsheet" disappears, and so does the choice window (where I earlier chose Mail). I am taken back to the Numbers (or Page) where I had started from. Diavonex's note indicated that after "creating ... " stage I should be taken to an option where I can type in email address where I want to  send the  file, if I want to copy it to another address etc. I cannot arrive at that page - no matter whether I am working with Pages or Number, or which format I choose for the file to share !
    I will try to close as you have suggested and try. However, I have switched on and off several times by now, but nothing changed!
    Will look forward to any ideas to solve this !!!
    Thanks much!
    Best

  • Mail options & disposable addresses moved!

    Did anyone else lose access to their disposable addresses?  They're under 'Mail options', which used to be a very clear text button at the top left of the mail screen.  I've finally found that it's moved to the 'Gear cog' tools icon, at the top right, which is probably more logical.  
    Just in case anyone else spends 20 minutes trying to find it, like I did  

    Tried Live Help, but they were out to lunch or asleep, so that was 10 minutes wasted waiting for someone to respond. So with heavy heart used the phone, went throught the usual rigmarole and "did you know you can fix problems by looking online...." (yawn) and eventually insisted on being put throught to Yahoo, a patient and very polite guy near Delhi, who persuaded me to share control, got into the problem secondary account and just clicked around a bit, merely looking at settings, didn't change a thing, asked me to send another test email to one of the problem disposable addresses. Lo and behold it worked.
    The equivalent of kicking a car to make it start Isn't science marvellous?

  • EMAIL BILLING DOCUMENT TO CUSTOMER THROUGH SEND MAIL OPTION IN VF02

    Hi
    I want to make active mode in send mail option is in VF02/VF03.
    see below how to reach send mail option is in vf03
    There is one more option if u go vf03 give the billing document and go to issue out put , choose the print preview and go to text which is placed at top right side and click on that option there send mail option available. can we make active that option since it is showing in gray mode.
    Regards
    Venkat

    Venkat,
    If your SAP system's Output is configured with the proper output type and SMTP or IMAP mail sending servers then its possible to send mail directly by clicking the send email tab.
    I have a little knowledge about this technical congiguration. But we have solution manager from where we send mail directly to the user's Email.
    And also yu have to configure Workflow setting.
    Please take help of Workflow ABAP consultant.
    Thanks,
    Raja

  • One search help for multiple select-options in webdynpro abap

    Hi,
    I need a way to use one search help for multiple select-options fields. My scenario is :
    I have a table for keeping different organizational units' values of different systems. I have pasted some sample data from this table at the end of this mail. On the screen I want to have 1 select-options filed for werks, and 1 select-options filed for vkorg. (In fact I will have more org. unit fields...) In the beginning of my application the user will select sid.
    If the user selects ADS as SID, when he opens search-help for the first org. unit (werks), he will see the records with SID: ADS, VARBL = $WERKS, LANGU = SY-LANGU.
    If the user selects AGT as SID, when he opens search-help for the second org. unit (vkorg), he will see the records with SID: AGT, VARBL = $VKORG, LANGU = SY-LANGU.
    I have created a search-help taking SIDD, VARBL and LANGU as import parameters; used field mapping and bound this search help to my table. I have created 2 context nodes : org1 and org2 having attributes SID, VARBL, VALUE, LANGU .
    I have assigned related SID, VARBL and Langu values to these attributes at runtime as I needed. That way, if I use input field and reference to the related context attributes org1-value and org2-value2 accordingly, search help works well as I want.
    However, when I use select-options field , I can not bind the field to the context data. I can give reference only to ddic structure. Is there any way to reference to a context attribute? I searched for this in SDN, but could find nothing.
    I think I won't be able to use this way. What do you say?
    As I read from forums maybe using OVS help will be suitable for me. But I have to use one search-help for all select-options fields. Do you know how I can determine the active select-options field and pass its name (for instance "werks" ) as parameter to this OVS search help. (Also I'll pass SID and LANGU.)
    MY TABLE (ZBYYT080) CONTENTS:
    SID     VARBL     VALUE     LANGU     VTEXT
    ADS     $WERKS     1     T     Werk 0001
    ADS     $WERKS     11     T     OZYAS  GIDA URETIM YERI
    ADS     $WERKS     5501     T     BOYA GEBZE FABRİKASI
    ADS     $WERKS     5502     T     BOYA CIGLI FABRİKASI
    AGT     $WERKS     2301     T     KAMLI DAMIZLIK
    AGT     $WERKS     9601     T     PANAR DENIZ URETIM YERI
    ADS     $VKORG     22     T     AA KİMYASALLAR
    ADS     $VKORG     8001     T     İINSAAT BOYALARI
    AGT     $VKORG     6500     T     DAMk St.Org
    AGT     $VKORG     5400     T     PANAR St.Org.
    I wish I'm clear enough..
    I will be gald if someone answers me as soon as possible...
    Thanks İn advance..
    MERAL

    Hi,
    Your ques is how to refer to a DDIC search help to refer to selection screen parameter ?
    Am I right ?
    If Yes, then in the interface IF_WD_SELECT_OPTIONS
    method ADD_SELECTION_FIELD, ADD_PARAMETER_FIELD etc
    have importing param like I_VALUE_HELP_TYPE and  I_VALUE_HELP_ID, I_VALUE_HELP_MODE, I_VALUE_HELP_STRUCTURE
    etc which may help you to link your create DDIC Search help to selection screen params.
    this is just a clue from my side. I haven't tried it myself.
    You can go to the where used list of this method and find some sample implementations which use these params.
    Hope this helps.
    Regards
    Manas Dua

  • Why can't I link to an image in Yahoo! mail options Signature? It works in Explorer.

    I use the Yahoo! Mail options Signature to insert a signature every time I e-mail. I have inserted my logo and cannot get the link to work when you browse over the logo.
    I could not even copy the link in Firefox, I had to do it in Explorer. This may be the problem.
    Why can't Firefox allow images to copy in the Yahoo! signature area and link to them?
    I am going to be forced to go back to using Explorer since I want everyone to be able to simply click on the image to link to my site.
    HELP!

    I just did a test in google chrome. I can not create a folder under google chrome, but I can create a folder under Internet Explorer.

  • Mail option is missing from share menu

    "Mail" is missing from the share menu. When I go to the Extensions preferences in the System Preferences it is checked buy also grayed out. On Apple.Com it clearly shows in the example that Mail is present in the Share dropdown menu. I verified that my Mail account is correct. I have also tried Apple's instructions on this page: If sharing options and Markup are missing after you install OS X Yosemite - Apple Support. Still nothing works. The Apple Help file even says this:
    Share Menu
    Select the items that you want in the Share menu, and in the Social widget in Today view in Notification Center.
    The Share menu is available in several apps, including Safari, Contacts, and the Finder. If an item is selected, but you don’t see it in an app’s Share menu, then you can’t use that item to share in that particular app.
    Only items that allow posting or messaging can appear in the Social widget.
    So, it would seem from this that Mail is not available in Photos? I find that hard to believe. I would be nice to still be able to email a photo directly from the new Photos App. Any other help would be appreciated. Thank you.
    Stan

    Having the same issue!  Just updated to 10.10.3 and still no mail option in the share menu for Photos app!  Share via email works fine in Safari but it is not available in Photos app.  Hopefully someone will advise or respond asap otherwise, will wind up following the steps to reverting back to iPhoto!!

  • HT5624 Sir, I have my id and pass but I can't change or edit my secret question and answer B'coz when I creat my id I didn't entered 2nd mail option that's why I forget my info about secret question . Naw I want to reset my secret question and answer,plz

    Sir, I have my id and pass but I can't change or edit my secret question and answer B'coz when I creat my id I didn't entered 2nd mail option that's why I forget my info about secret question . Naw I want to reset my secret question and answer,plz help me out

    You need to contact Apple to fix this. Pick your country here:
    http://support.apple.com/kb/HT5699?viewlocale=en_US

  • Hello sir i have IPhone 5 this imei is : ******** and i but my mail and password but the icloud tell me its wrong please help me my mail is : ********  and my password is ********

    hello sir i have IPhone 5 this imei is : ********** and i but my mail and password but the icloud tell me its wrong please help me my mail is : *********
    and my password is *******
    <Personal Information Edited by Host>

    You might try the following steps:
    Restart the device by holding down the on/off button until the power down slider appears.
    Try entering your password in another location (i.e. when you are using a different wifi network)
    Reset all settings (settings > general > reset), this resets some of your settings to factory default. It’s not a complete removal of settings. It removes all of your preferences for Wi-Fi, Bluetooth, Do No Disturb, Notifications, General, Sounds, Brightness & Wallpaper and Privacy. It does not remove any of your data.
    Try signing out of iCloud and back in (only if find my phone is disabled)
    If this doesn’t help your best option may be to contact Apple ID Support, upon speaking to an operator you should explain that your problem is related to your Apple ID, this way you will not be charged for assistance, even if you don’t have an AppleCare plan.

  • The mail option in my nokia asha 200 is not respon...

    I have a nokia asha 200. I update my phone when new updates are available. But i had to restore the settings of my phone to factory settings due to a problem occured while using themes downloaded from mobile9.com. But after i restored my mobile the mail option didn't respond. When i clicked on that icon nothing is showing. Then i clicked the goto option of my mobile and from there when i clicked the mail shortcut at that time it was showing that the application is invalid, please try later. Then i restarted my mobile. But i am still facing the same problem and now no mail shortcut is showing in the goto option. Even no mail option is showing when i try to add new shortcuts in the goto option of my mobile. Please help me out.

    If  you are not able to open the mail app using main menu, then it might have deleted.
    Better backup important data and reinstall the phone software using Nokia suite .
    Hope this helps.
    -------------------If this post helped you, click on accept as solution.------------------
    -----------------------------Appreciate by clicking on white star.----------------------------

  • How to define multiple recipents for send mail option

    Dear all,
    I am trying to send mail to multiple recipients. can some help me with a solution as we donot have orgnizational chart maintained in our organization.
    also
    is there some study material for how to use expression in send mail option
    thanks in advance.
    Best of regards,
    Gaurav Sood

    I don't know if there is a comparable FM like SO_USER_READ_API1 that uses a table for SOUDNAMEI1. I simply create a table of SOUDNAMEI1, loop SO_USER_READ_API1 adding to recipients and then SEND.
    This what you referring to?
    if there is a comparable FM, let me know. I don't 'see' any in package SO's FGs.
    Rick

  • Debugging a SEND MAIL option

    Hi Experts,
    Can any one help me in this issue.
    I am sending a PDF document throught SEND MAIL option.I have written the Code.I want to DEBUG the Code which i have written
    in the Print Program when I save the Document Like INVOICE means (option 4 the mail will be send when we save the Doc).
    Thanks & Regars.

    Hi,
    Could you please explain your poblem clearly..
    If you want to debug your code keep a break point and save the invoce.. which will stop in your code..
    If you are unable to set the external break point use BREAK-POINT statement to put the break point and then debug..
    Thanks,
    Rakesh

  • Send mail  option triggering mail into documents

    hi
    im using send mail option in the workflow definition, the mail is triggered but its going to the documents folder and not into the workflow inbox.
    if i want to make the option like..  complete the work item by double clicking.
    is it possible with the send mail option?
    please suggest me..
    Babu

    It is not possible to send mail options sending workitem to your workflow. It will send the mail to your inbox i.e to Document folder. If your work involves some decision steps .. use decision task. Or else use Activity and create a task behind that.
    Hope this reply helps You

  • Exchange ActiveSync really the only mail option in...

    Another 808 question...
    Is Exchange really the only mail option?  I've been able to sync my Gmail account and grab all my contacts (which is awesome, btw).  But then I try to create another mailbox.  I just want to set up my corporate email (a regular IMAP account), but  I see "Exchange ActiveSync" is the only option.  Nothing about other providers or anything else like on other Nseries phones.  I choose it anyway thinking it will bypass it, but it simply says:  "Maximum number of mailboxes chosen...please delete existing mailbox".
    Do I really need to purchase a 3rd party app just to get a second mailbox?  What am I missing here?
    Solved!
    Go to Solution.

    Hi micahd,
    Thanks for your feedback and welcome to the forum.
    When you have a SIM inserted you should see all mailbox options when you go to MENU>Mail>New mailbox
    Besides Exchange Active Sync you should see several preset options depending on your region and the 'other' options which allows for a manual install.
    If you do not see these options I would suggest you soft reset the Nokia 808, this will reset default settings and not remove any personal data. Dial *#7780# followed by the (optional) security code 12345 and check again after the reset finishes.
    If this does not resolve this you may try a hard reset which will remove all personal data from the phone's internal memory, so make a backup in Nokia Suite first (Tools/Backup). Then dial *#7370# again if asked followed by the  security code 12345.
    If after this reset you still do not see the additional options please visit a Nokia Care Point for further assistance.
    Hope this helps, let us know how you get on.
    Kosh
    Press the 'Accept As Solution' icon if I have solved your problem, click on the Star Icon below if my advice has helped you!

  • How to remove the voice mail option

    How can i remove the voice mail option in my iphone 4s . Whenever i tap that icon the carrier  charges me ? pls help me ...................

    Hi, I'm having the same problem. I need the email icon disabled or removed. It can be done via the UI but I'm running it on a Citrix server and need it to default to disable or best case gone.

Maybe you are looking for

  • How to receive receipt in third-party system?

    I want to send message from third-party system via HTTP-adapter and integration server to SAP MDM. I have created outbound interface for my third-party system, message for this system, message mapping between my messageand ABABusinessPartner, scenari

  • Mine, her's & ours – how to organize photos in a multi-Mac family?

    Hi folks, from a quick search at Apple discussions I realize that my following problem is a very common, but essentially an unsolved one. So rather than a final solution, I'm looking for ideas and discussion on how to organize photos in a family sett

  • Startup screen resolution low

    I noticed that the startup screen (the one with the grey apple) is being displayed at a lower resolution. I can tell because it looks all fuzzy on my LCD which has a native resolution of 1280X1024. Also, when I'm at the boot camp selection menu the d

  • Corruption of iphoto

                   I had some kind of corruption on my finder.  I now cannot open iPhoto and when I try to reinstall OSX Snow Leopard it won't let me because of iPhoto

  • Is their a Tiff viewer compatible with the US Patent Office Web Site?

    Viewing image files of pre-1948 patents at the USP&TMO site requires a compatible Tiff file viewer. The one built into FF4 and previous versions does not work. Is there a plug-in for this? In the past AccelViewTiff worked. Quicktime doesn't work exce