Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Oct 3, 2009, 02:07 PM   #1
ViViDboarder
macrumors 68040
 
ViViDboarder's Avatar
 
Join Date: Jun 2008
Location: USA
Mail Rules Applescript

I'm trying to make a script to run from a rule that will download my attachments.

I'm a little stuck because I take the rule part out and tell it to just run on a selection and it works perfectly so it's got to be something to do with the perform_mail_action aspect.

It just runs the rule (I had it change the color of the item so I know it ran) but the script doesn't do anything. Ideas?

Code:
on perform_mail_action(theData)
   set theOutputFolder to "Macintosh HD:Users:USERNAME:Dropbox:" as string
   set theSelectedMessages to |SelectedMessages| of theData
   set theRule to |Rule| of theData
   display dialog theSelectedMessages
   tell application "Mail"
      repeat with theMessage from 1 to count theSelectedMessages
         -- Process the current message
         set theAttachments to theMessage's mail attachments
         if theAttachments is not {} then
            repeat with theAttachment in theAttachments
               set theSavePath to theOutputFolder & theAttachment's name
               try
                  save theAttachment in theSavePath
               end try
            end repeat
         end if
      end repeat
   end tell
end perform_mail_action
__________________
iMac 21" Late '09 8GB iPhone3G Jailbroken MacbookPro iPod v5.5, Ubuntu x64 tower & EeePC 900, Lenovo T400
WinMatrix Profile | UbuntuForums Profile | XDA Forums
ViViDboarder is offline   0 Reply With Quote
Old Oct 3, 2009, 02:11 PM   #2
electroshock
macrumors 6502a
 
electroshock's Avatar
 
Join Date: Sep 2009
Something that might help:

http://forums.macrumors.com/showthread.php?t=791917
electroshock is offline   0 Reply With Quote
Old Oct 3, 2009, 02:13 PM   #3
ViViDboarder
Thread Starter
macrumors 68040
 
ViViDboarder's Avatar
 
Join Date: Jun 2008
Location: USA
Quote:
Originally Posted by electroshock View Post
Doesn't. I already read that. The guy on the bottom posted something that doesn't get messages from a Mail Rule, so it doesn't really help.

Anyone know what's off with this?
__________________
iMac 21" Late '09 8GB iPhone3G Jailbroken MacbookPro iPod v5.5, Ubuntu x64 tower & EeePC 900, Lenovo T400
WinMatrix Profile | UbuntuForums Profile | XDA Forums
ViViDboarder is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Better way to edit mail rules? Software for rules? gkremen Mac Basics and Help 0 Dec 2, 2010 05:36 PM
Applescript Mail Rule Help drivebyed Mac Programming 3 Sep 23, 2010 04:27 AM
Importing mail account settings, adding multiple e-mail address to mail rules in Mail infobleep Mac Applications and Mac App Store 3 Jan 31, 2010 04:01 PM
Applescript not working with mail rule bergmef Mac Programming 2 Sep 27, 2009 04:53 PM
Activating Mail rule within applescript FunkEye Mac Programming 0 May 7, 2008 01:00 PM


All times are GMT -5. The time now is 04:19 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Privacy / DMCA contact / Affiliate and FTC Disclosure
Copyright 2002-2013, MacRumors.com, LLC