Applescript

Joined
Jan 17, 2011
Messages
8
Reaction score
0
Points
1
Location
UK
Your Mac's Specs
15.4 MBP, 24" Cinema display, 60GB iPod Classic.OS X 10.6.6
Hello folks,

I've just started at the steep end of the Applescript learning curve, so please be patient.

I'd like to produce a script that takes control when the user closes each Imail message. The intention is to offer an automatic 'move to mailbox' facility for all mail that is opened (and subsequently closed) in either the Inbox or Sent mailboxes.

The 64,000 dollar question is simple: is it possible for a script to capture the 'message close' event in order for a script to provide the facility described above?

I appreciate that a script could be developed to examine each message in the Inbox/Sent mailboxes and take the corresponding action, but I'd rather approach this on an individual message basis.

Thanks in anticipation
 
Joined
May 19, 2009
Messages
8,428
Reaction score
295
Points
83
Location
Waiting for a mate . . .
Your Mac's Specs
21" iMac 2.9Ghz 16GB RAM - 10.11.3, iPhone6s & iPad Air 2 - iOS 9.2.1, ATV 4Th Gen tvOS, ATV3
Welcome to M-F SgtDave

Mate go and have a look at This page as its a collection of Apple Scripts for Mac Mail. There is a download link down the bottom, as well as i see there is one for Archiving Messages. If ts not exactly you could post the code here and someone could alter it to work for you.

Also google Mac MAil Apple Scripts and it brings up quite a few pages and i dare say there would be a script in there as well

Introduction to Mac Mail Apple Scripting

HTH

Cheers
 
OP
S
Joined
Jan 17, 2011
Messages
8
Reaction score
0
Points
1
Location
UK
Your Mac's Specs
15.4 MBP, 24" Cinema display, 60GB iPod Classic.OS X 10.6.6
Welcome to M-F SgtDave

Mate go and have a look at This page as its a collection of Apple Scripts for Mai. There is a download link down the bottom, as well as i see there is one for Archiving Messages. If ts not exactly you could post the code here and someone could alter it to work for you.

Also google Mac MAil Apple Scripts and it brings up quite a few pages and i dare say there would be a script in there as well

Introduction to Mac Mail Apple Scripting

HTH

Cheers

Hello TattooedMac,

Greetings from the UK and thank you so much for the information. I'll take a look at it a little later and let you know if it fits the bill.

Dave
 
OP
S
Joined
Jan 17, 2011
Messages
8
Reaction score
0
Points
1
Location
UK
Your Mac's Specs
15.4 MBP, 24" Cinema display, 60GB iPod Classic.OS X 10.6.6
Having researched this at some length, I stumbled across an article that states "Apple events are inter-application not intra-application". This seems to suggest that I cannot develop a script invoked by a 'message close' event in iMail.

I'll call it a day on this unless someone knows a work around.
 
Joined
May 19, 2009
Messages
8,428
Reaction score
295
Points
83
Location
Waiting for a mate . . .
Your Mac's Specs
21" iMac 2.9Ghz 16GB RAM - 10.11.3, iPhone6s & iPad Air 2 - iOS 9.2.1, ATV 4Th Gen tvOS, ATV3
Hey mate. Well that is a shame isnt it.
Have you checked out Automator . . . I use this quite a bit now since learning to use it. the last work flow i made was a simple mouse click one. I opened quite a number of Apps going to the menus and doing things there as well. The work flow went for about 30ses and when done a had returned from making my coffee . . . . . Wortha look or research

I have done a little and seems there is no such Automator workflow.
I did see this though Intro to Mail Scripting . . . You saaid you have looked around but though i might put it in. No time to read it thru myself as work is calling me.

Maybe a Apple Script, Automator Action Workflow combination could do what you want. . . . .. Just giving you options before you shut this project down


Cheers

EDIT : Read this Apple support article paying attention to the posts 5/6 ?? About smart folders and mail archiving ?!?!?!? HTH
 
OP
S
Joined
Jan 17, 2011
Messages
8
Reaction score
0
Points
1
Location
UK
Your Mac's Specs
15.4 MBP, 24" Cinema display, 60GB iPod Classic.OS X 10.6.6
Hey mate. Well that is a shame isnt it.
Have you checked out Automator . . . I use this quite a bit now since learning to use it. the last work flow i made was a simple mouse click one. I opened quite a number of Apps going to the menus and doing things there as well. The work flow went for about 30ses and when done a had returned from making my coffee . . . . . Wortha look or research

I have done a little and seems there is no such Automator workflow.
I did see this though Intro to Mail Scripting . . . You saaid you have looked around but though i might put it in. No time to read it thru myself as work is calling me.

Maybe a Apple Script, Automator Action Workflow combination could do what you want. . . . .. Just giving you options before you shut this project down


Cheers

EDIT : Read this Apple support article paying attention to the posts 5/6 ?? About smart folders and mail archiving ?!?!?!? HTH

You're a star TattooedMac. I'll take another look and let you know how I get on. Thanks again.
 
OP
S
Joined
Jan 17, 2011
Messages
8
Reaction score
0
Points
1
Location
UK
Your Mac's Specs
15.4 MBP, 24" Cinema display, 60GB iPod Classic.OS X 10.6.6
Hello again TattooedMac,

I have poked around a little more and looked at Automator as you suggested. Although it does have a 'close item' event for Outlook, alas, there is no equivalent for iMail.

Another approach may be using the 'selection' method to identify messages in the Inbox and Sent boxes, and use Automator to pass these to a script to determine what to do / where to file. As I very rarely give up on a challenge, this may be he only way to proceed at this point in time.

Wouldn't it be nice if Apple provided a 'close item' event in iMail in a future release!

I am some way from starting on this project, but I will keep you posted and let you have a copy of the finished article if you wish. In the meantime, many thanks for your assistance - much appreciated.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top