Applescripts in RSS in mail

I want to perform an action when a given rss updates (search for a linked file on the message and if available download it) but rss feeds doesn't seem to work exactly like mail messages in mail.
I subscribed to an rss feed in leopard, asked to put that feed in my inbox whenever it updates and created a new rule for it running an applescript.
For example if I run this test script:
using terms from application "Mail"
on perform mail action with messages newMessages
repeat with newMessage in newMessages
say "i received a message"
tell application "Mail"
set senderName to (extract name from sender of newMessage)
set SubjectText to subject of newMessage
set MailMessage to (content of newMessage)
say "it's from" & senderName & "and it says" & SubjectText & MailMessage
end tell
end repeat
end perform mail action with messages
end using terms from
it will read the confirmation that it receive the message but wont say any other texts.
Is this an error with my script or is it because rss in mail is just funny?

In AppleScriptObjC, you connect your button by using *Interface Builder* outlets and actions, the same as any other Cocoa application. For example, when you define properties and handlers in your script such as:
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
font-weight: normal;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #FFEE80;
overflow: auto;"
title="this text can be pasted into Xcode's Script Editor">
property aButton: missing value
to doButtonStuff_(sender)
-- do something when the button is clicked
log sender's |title|()
end doButtonStuff_
</pre>
… from *Interface Builder*, the script items will appear in the script delegate's connections, where they can be connected directly to the interface objects.
There still aren't many examples, but see:
Apple's AppleScriptObjC Release Notes
MacScripter's AppleScriptObjC in Xcode
To edit older applications, you can enable the AppleScript tab in IB's Inspector Window (see the above release notes), but to make a new application using *AppleScript Studio* you will need to use a project template from an older Xcode version, since the new version only has the ASOC templates.

Similar Messages

  • Is there a way to get out of using RSS in mail.app and go back to Safari?

    Hello,
    I am a big RSS user and have a pretty huge and unwieldy subscription list. When Leopard shipped, I started using mail.app to read my RSS. I went so far as to delete all of my subscriptions from Safari and rely entirely on mail.app.
    As some of you may have noticed from other threads in this forum, RSS in mail.app seems to be not ready for primetime. Specifically, if I leave mail.app open for more than about an hour, the RSS feeds stop updating entirely or update sporadically. It is at this time when I will also invariably find a Database.sqlite3 file in my trash can (which prevents the trash can from being emptied, too).
    If I restart mail.app, the feeds start updating again BUT INCLUDE HUNDREDS AND HUNDREDS OF OLD ITEMS. This happens every time I restart mail.app now. I have read all of the other threads that suggest that perhaps dot mac bookmark synching is to blame. This cannot be in my case since I have it all turned off and am not a dot mac member. I have no plugins installed in mail.app or safari.
    I have come to the conclusion that RSS in mail.app is too buggy and unreliable to be used and I would like to go back to Safari. The trouble is that when Leopard shipped, the idea of RSS in mail.app made perfect sense to me and I got so enthusiastic and "there's no going back" that I deleted my enormous amount of RSS subscriptions in Safari. Is there anyway to export my RSS subscriptions from mail.app so that I can import them into Safari? I REALLY don't want to try and add them again one by one.

    here is a link to macosxhints.com that tells you how to output all of your feed URLs to a terminal window. from there you can cut and paste them into your new feed reader of choice...
    http://www.macosxhints.com/article.php?story=20080319094830396
    and if you are in the marked for a new reader may i suggest David Watanabe's excellent NewsFire. he had just recently made it totally free as a gift to the macintosh community.
    best of luck.

  • Automator/applescript to forward junk mail as attachment...how?

    I finally came up with a real use for Automator and Applescript -- I was delighted.
    I want to modify my junk mail rule to run an Applescript that forwards a mail message as an attachment (not just a regular forward) to Spamcop.
    It has to be forwarded as an attachment. First shot, I simply went to modify my junk mail rule but, alas, found that "forward as attachment" is not an option for Mail's rules. Fortunately, there is a "run Applescript" option so...
    I fired up Automator, hoping to see how to tell Mail to forward a message as an attachment. Again, alas, no "as attachment" option there. So then I started exploring how to invoke the Mail menu item Message > Forward as Attachment but, haven't been able to figure it out.
    Any help would be appreciated. Especially since this will be the first time I've actually found a use for Automator, which is great... I just know it's not merely eye candy...

    Here is some starter code, to be saved into the current users' '~/Library/Scripts/Applications/Mail/' folder - as a script file ...
    using terms from application "Mail"
    on perform mail action with messages tMessages
    repeat with i in tMessages -- Cycle throught the list of incoming 'Rule' filtered e-Mail messages.
    -- File path file Name of temporary attachement file.
    set file_Name to (((path to home folder from user domain) as string) & (do shell script "date +%Y%m%d%H%M%StempFile.txt"))
    try -- Capture any unexpected AppleScript error.
    set FREF to open for access file file_Name with write permission -- Create temporary attachement file.
    write ((source of i) as string) to FREF starting at 0 -- Write to temporary attachement file.
    close access FREF -- Close temporary attachement file.
    -- Make new outgoing e-Mail message, and attach respective attachment file.
    set tMessage to make new outgoing message with properties {visible:true, subject:"My Subject", content:("My Body" & return & return)}
    tell content of tMessage
    make new attachment with properties {file name:(file_Name as alias)} at after last paragraph
    end tell
    end try
    try -- Capture any unexpected AppleScript error.
    tell application "Finder" to delete file file_Name -- Trash temporary attachement file.
    end try
    end repeat
    end perform mail action with messages
    try -- Capture any unexpected AppleScript error.
    tell application "Finder" to empty trash -- Delete all temporary attachement files (plus all other items) in the trash can.
    end try
    end using terms from

  • AppleScript for import from Mail

    Is there an AppleScript that will move mail photo attachments to iPhoto? I will be receiving a lot of emails with photos in the next few weeks. I can use the slideshow in mail to move to iPhoto but would like something faster.

    Curt
    When you receive an email with photos, you will see two buttons just below the email headers. One is Slideshow, the other is Save. Click and hold on the save button and you'll get the 'Add to iPhoto' option.
    Regards
    TD

  • AppleScript to move RSS in Mail to another mailbox?

    I'm trying process the RSS feeds I have sent to my Mail app but it would seem to do that the RSS files need to be
    in a standard mailbox. Ultimately I need to get just the titles of the RSS emails into a text file. I have found I can
    do that with a mailbox but I can't find a way to perform that on an RSS folder.
    Any ideas or help greatly appreciated.
    Thanks,
    Carl

    Robert -
    Thanks for the heads-up.  Now that the browser has been updated, I will post this question again -- in the forum you recommended.
    Monday was my 1st venture into the Apple Support Discussions.  Spent most of that day trying to obtain an Apple ID.  Started by filling out all the information Apple requires.  When I tried to submit that information, I received a message saying I already had an Apple ID.  Guessed that this happened when Apple somehow obtained my email address -- which they have been using frequently ever since to send promotional material.
    So, went to the web page for forgotten passwords.  Filled in given name, surname, and email address.  Then, tried to go to the next page by clicking on the 'Next' button at the foot of that page.  Nothing happened.  The status bar remained blank.  (You will see more of that dilemma in a later post to this forum entitled: Problem Navigating Apple Support Discussions.)
    After repeating these steps more than once, I finally phoned Apple tech support.  The person I reached was very helpful.  She was kind enough to confirm that I did have an Apple ID and directed me to the web page where I could create a password.  While I am most grateful to that tech support person, I have not named her -- for fear of the criticism she would very likely be receiving for letting me loose in these forums.
    Thanks again for your assistance,
    David

  • Why is the applescript action in a mail rule always pushed last?

    Hi,
    I try to create a rule in Mail such that an Applescript is executed and then other things are done to the message (such as move it to a folder, for example). I want this to be the preceise order of things: first, do script, next, do other things.
    I create my rule in the Mail preferences, and it all goes fine. But when I reopne the rule to examine it again, I see that the Applescript part of the actions has now been pushed to the end of the action list.
    I wonder if anyone can explain the logic of this? I didn't find any reference in the help for why is this happening. Is it because of the possible time-out associated with the applescript (so as not to hang the rest of the rule evaluation)?
    Thanks for any insights.
    -- ivan
    PM DC 2Ghz G5, PB 1.5GHz G4   Mac OS X (10.4.5)  

    I don't know exactly but it might be that Mail has no way of knowing that the Applescript has completed in order to continue. So, making it the last step ensures that the complete rules will work everytime.
    What are you trying to do with your messages? Perhaps we can figure out a workaround.
    Bronson

  • Please help with troubleshooting Applescript invoked by Apple Mail rule

    I set up an account with Boxcar to get push notification of incoming email on my iPhone. I did this because I passworded my iPhone and cannot see incoming messages without entering the password. Now all I need to do is glance at the screen to see whether it's worth it or not to look at the email. In order to use the Boxcar service, I needed to set up a rule to redirect all incoming mail to my private address on Boxcar. The issues that I have are two-fold. First, I do not like blindly forwarding email content to Boxcar regardless of their stated claim that they strip out the sender and subject of a message and discard the rest. Second, if I get a large incoming email, then My method will have to send the large content out again - a waste of resources. To get around this, I tried to write an Applescript for Apple Mail that is invoked by a rule applicable to all messages. The script redirects all messages to my private Boxcar email address and strips out the content of the message. The script follows:
    using terms from application "Mail"
    on perform mail action with messages selectedMessages
    set AppleScript's text item delimiters to ""
    repeat with theMessage in selectedMessages
    set boxcarMessage to redirect theMessage
    tell boxcarMessage
    make new to recipient at beginning of to recipients with properties {address:"[email protected]"}
    set content to " "
    set subject to theMessage's subject
    end tell
    send boxcarMessage
    end repeat
    end perform mail action with messages
    end using terms from
    The problem with this script is that it still sends out the content even though I thought I was setting it to a single space. Other than that, it does just what I need it to do. Any suggestions on corrections, an easier Applescript, or another way to approach the whole issue? One drawback to this approach is that I need to have a Mac running at home that processes the rule for the incoming messages - probably there is no way around this?
    Thanks!

    That makes sense, but then that gets back to your original comment:
    "redirecting the message will send the entire message, as-is."
    I tried to eliminate the attachments by adding the line:
    delete boxcarMessage's attachments
    but it did not work - the attachments were redirected also. So here is the script as it stands now:
    using terms from application "Mail"
    on perform mail action with messages selectedMessages
    set AppleScript's text item delimiters to ""
    repeat with theMessage in selectedMessages
    set boxcarMessage to redirect theMessage
    delete boxcarMessage's attachments
    tell boxcarMessage
    make new to recipient at beginning of to recipients with properties {address:"[email protected]"}
    end tell
    delay 3
    send boxcarMessage
    end repeat
    end perform mail action with messages
    end using terms from
    I appreciate the input. Intuitively it seems like this is doable, but the solution escapes me.

  • RSS in Mail no longer updates

    Mail stopped retrieving RSS feeds at some point overnight. Restart of Mail and the mac make no difference.
    All I can see in the logs is:
    08.01.08 07.50.05 Mail[2967] Unread count went negative for mailbox ...
    where on each line ... is the name of the feed.
    Manually refreshing each feed does nothing and logs nothing.
    Am at a loss - any hints welcome.

    your feed files are located in homefolder/library/pubsub you will see two folders, a database folder and a feeds folder, the database folder contains the database file. could be that either feeds or database file are corrupted.
    i would first delete all the feeds and import them again from safari.
    hope this helps

  • Applescript auto-reply in mail updates???

    Hi everyone!
    Some time ago I posted a question about how to get an auto-reply set up in Mail using rules and applescript. I was told there was a bug and I'm just curious does anyone know if this has been fixed in 10.5.5? I made some tests and it seems it's still an issue but I just wanted to know if anyone has any additional info?
    Thanks in advance!
    Reg

    Thanks for the reply Camelot and sorry for being vague...as reference here is a previous post:
    http://discussions.apple.com/thread.jspa?threadID=1561599&tstart=0
    I know I can send a basic auto-reply...but what I want to do is to send one using Applescript...actually it's creating a new mail message...because I want to put a bit more detail into it than I can do with the regular auto-reply such as changing the subject and adding attachments. But for some reason the handler doesn't trigger with the Applescript and it doesn't work. What I do is I use Applescript which triggers another Applescript app which creates the new message (auto-reply) that I want...but sometimes it's buggy and causes Mail to crash because it takes so long for the rule to process...hope that makes sense?
    Thanks again for your input...
    Reg

  • Where is the RSS in Mail?

    I'm new to Leopard and although I can add RSS feeds in mail, i can't actually see them. Are they not meant to have an icon in the side panel?

    The previous Mail did have:
    MAILBOXES
    ON MY MAC
    The above separated the mailboxes slightly.
    Yes, the On My Mac has been removed and everthing comes under one heading of Mailboxes now.
    All my mailboxes are there that I had before though.

  • RSS in Mail. Can it be eliminated?

    I hate RSS. I have it off in Safari in the Debug Menu. I've deleted the feeds in Apple Mail but they just come back. Set to Manually and After One Day in Mail preferences.
    I see no way to turn it off totally in Mail. A debug menu to activate? Anything.
    RSS is such a useless way to read on the web.
    Message was edited by: musicmaker

    I just wanted to add that I have managed to delete the Apple Hot News RSS feed from mail.
    A simple right click and delete feed was doing nothing, nothing via the menu would work. Each time it would ask if I wanted to delete is, and yes I wanted to, but there it stayed
    I ended up navigating to:
    User > Library > Mail > RSS - I deleted the contents of RSS, but did leave the RSS folder in place.
    Then I relaunched Mail and the Hot Apple News RSS feed was still there, but was showing an error.
    This time when I right clicked on it and chose delete it went away!
    Yay!!
    Will

  • Using AppleScript to auto-archive mail in Outlook 2011

    I want to use AppleScript to set up a schedule to auto-archive mail greater than X days old. What I've found so far is below, and the error I'm receiving is "error "Microsoft Outlook got an error: Can’t get pop account \"TargetProcess\"." number -1728 from pop account "TargetProcess"".
    # the time we want to archive from
    set theArchiveCutoffTime to ((current date) - (32 * days))
    property theCount : 0
    tell application "System Events"
      set targetProcess to count (every application process whose name is "Mail")
    end tell
    tell application "Microsoft Outlook"
      set thisAccount to pop account "TargetProcess"
      set thisFolders to mail folder of thisAccount
    # find the "Inbox" of topFolder and "Mail ARCHIVE" of on my computer
      repeat with thisFolder in thisFolders
      if name of thisFolder is "Inbox" then
      set theInbox to thisFolder
      else if name of thisFolder is "Mail ARCHIVE" then
      set theARCHIVE to thisFolder
      end if
      end repeat
    # find the archive "Inbox"
      repeat with thisFolder in mail folder of theARCHIVE
      if name of thisFolder is "Inbox" then
      set theArchiveInbox to thisFolder
      end if
      end repeat
      set theArchiveTarget to theArchiveInbox
    # archive the Inbox
      repeat with theMessage in message in theInbox
      if time received of theMessage < theArchiveCutoffTime then
      move theMessage to theArchiveTarget
      set theCount to theCount + 1
      else
      # we get messages from oldest to newest
      exit repeat
      end if
      end repeat
    # archive sub-folders
      repeat with thisSubfolder in mail folder of theInbox
      # find the archive subfolder corresponding to this
      repeat with thisARCHIVEubfolder in mail folder of theArchiveInbox
      if name of thisARCHIVEubfolder is name of thisSubfolder then
      set theArchiveTarget to thisARCHIVEubfolder
      end if
      end repeat
      # archive messages
      repeat with theMessage in message in thisSubfolder
      if time received of theMessage < theArchiveCutoffTime then
      move theMessage to theArchiveTarget
      set theCount to theCount + 1
      else
      # we get messages from oldest to newest
      exit repeat
      end if
      end repeat
      end repeat
    end tell
    I'm working in AppleScript Editor v2.6.1 (152.1), Microsoft Outlook 2011 v14.3.5, OSX 10.9.4 Mavericks.

    Ok, red_menace above me had a shorter and more elegant solution to the question, I'm adding this just for another example.
    To solve your problem I'd make a mail rule that looked for any messages with "Filename:" in them (along with whatever criteria you wanted, like sender, domain, etc). The mail rule would execute the Applescript. My assumption is that the "Filename:foobar" text could be anywhere in the email, not necessarily the first thing in a paragraph, so I had to parse it differently.
    The results end up in a datalist, (theFilename {} ) that you can parse later to collect all filenames found in whatever messages were processed.
    I realize this could be cleaner, hope it's not hard to follow, but I did it really fast. It works flawlessly for me, picking out the name of the file no matter where in the email it appears.
    using terms from application "Mail"
    on perform mail action with messages theSelectedMessages for rule theRule
    repeat with aCounter from 1 to count theSelectedMessages
    set theMessage to item aCounter of theSelectedMessages
    set theContent to content of theMessage
    set theWords to every word of theContent
    set theFilename to {}
    set tid to AppleScript's text item delimiters
    set AppleScript's text item delimiters to ":"
    repeat with thisLoop in theWords
    try
    if (text item 1 of thisLoop) is "Filename" then
    set end of theFilename to (text item 2 of thisLoop)
    -- rest of your logic goes here the display is just to show it finds the filename, take it out!
    display dialog theFilename ¬
    buttons {"OK"}
    end if
    end try
    end repeat
    set AppleScript's text item delimiters to tid
    end repeat
    end perform mail action with messages
    end using terms from
    Message was edited by: stephen.bradley Typos for the win!

  • Import opml rss into mail

    Hi:
    How does one import an ompl file of rss feeds into mail 3?
    Thanks.

    sorry wrong forum mod's please delete.

  • Applescript rule to print Mail?

    I've been looking around the web trying to find out if there is a way to use Applescript to print out emails without writing to a temporary file and doing a shell script.
    Can it be done? Is automator a better choice.
    OS X 10.4.8 ad Mail 2.1

    Still haven't found any other solution than to use a shell script and temporary file. Is this just a shortcoming of OS X Mail's Applescript capabilities?
    Simply, based on some rules in Mail, I just want to print messages to a network printer via a script.
    No go?

  • Applescript to move incoming mail to a folder

    I use IMAP to read mail from different devices, I wish to keep an archive on one computer.
    Rule for incoming message moves unread message just fine, but if they have been read from another device they will not be moved by a Rule.
    Looking for a work-around, does anyone have a applescript that will run as a mail rule to move incoming (unread or read) messages to a folder?

    While the applescript below works it has the same problem as the rules, does not move message with read set.
    Rule
    Created a rule with the following conditions
    Account     myIMAPaccount
    Perfor the following actions
    Run AppleScript     myMoveScript
    Stop evaluating rules
    Here's the script:
    AppleScript run as Mail rule to Move messages
    using terms from application "Mail"
    on perform mail action with messages these_messages for rule this_rule
    tell application "Mail"
    set the message_count to the count of these_messages
    repeat with i from 1 to the message_count
    set this_message to item i of these_messages
    move this_message to mailbox "myArchiveMailbox"
    end repeat
    end tell
    end perform mail action with messages
    end using terms from

Maybe you are looking for

  • How to get a defined bean  in another  bean?

    What should I do if I want to used a bean defined in the faces-config and I want to use it in another bean?

  • Converting hex to number & date

    Hi! Im having a problem converting the hex code to the number & date. select low_value,high_value from ALL_TAB_COL_STATISTICS; Iv tried HEX_TO_CHAR and that works fine. select column_name, UTL_I18N.RAW_TO_CHAR(low_value),UTL_I18N.RAW_TO_CHAR(high_val

  • Error MBR1213 again, webmail locked out

    Yet again, attempting to collect email is producing the error message AUTH MBR1213. This appears to be produced by Yahoo rather than BT, but information appears to be non-existant. Usually, I can still get my email by going to the webmail page, but t

  • Mass change of Serial number

    Hi SAP Gurus, I have a Requirement to change the serial number / Material in huge numbers. Is there any way to change the Material / Serial number in mass maintanence functionality? Please let me know any other functionality. Regards, Senthil

  • Slip audio clip but leave keyframes unchanged?

    Hi all, Is it possible to slip an audio clip without shifting the keyframes? In other words I'd like to use a different part of a music track without having to then go and select all the volume keyframes and adjust to rematch the holes in dialogue. I