• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: On My Mac
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: On My Mac


  • Subject: Re: On My Mac
  • From: Luther Fuller <email@hidden>
  • Date: Wed, 03 Jun 2009 13:16:28 -0500

Below is the script for my latest On_My_Mac handler. I've removed the repeat loop since it is not necessary for testing On My Mac. (I used it to get the path to the folder containing the message files.) It works correctly with all the mailboxes I have in Mail. But ... do you have mailboxes that will make it fail?

tell application "Mail"
	activate
	try
		set frontViewer to (message viewer 1)
	on error
		return
	end try
	set selMailbox to selected mailboxes of frontViewer
	if (count items of selMailbox) ≠ 1 then return
	set selMailbox to (item 1 of selMailbox)
	--
	if not my On_My_Mac(selMailbox) then
		beep
	else
		display dialog "\"On My Mac\"!"
	end if
end tell ------------------

on On_My_Mac(mbox) -- mbox is a Mail mailbox.
tell application "Mail"
try
set mboxName to (name of mbox) as text
unread count of mbox
on error
return false -- RSS or Notes
end try
--
if mbox is trash mailbox then return false
if mbox is inbox then return false
if mbox is sent mailbox then return false
if mbox is drafts mailbox then return false
if mbox is junk mailbox then return false
if mbox is outbox then return false
--
if first character of mboxName is in {"I", "D", "J", "N", "O", "S", "T"} then
if mboxName is "INBOX" then return false
if mboxName starts with "Deleted Messages" then return false
if mboxName starts with "Drafts" then return false
if mboxName starts with "Junk" then return false
if mboxName starts with "Notes" then return false
if mboxName starts with "Outbox" then return false
if mboxName starts with "Sent Messages" then return false
if mboxName starts with "ToDos" then return false
end if
--
try
set acnt to (account of mbox)
name of acnt
account type of acnt
return false -- mailboxes On My Mac have no account
end try
end tell
return true
end On_My_Mac


_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
References: 
 >On My Mac (From: Luther Fuller <email@hidden>)
 >Re: On My Mac (From: Deivy Marck Petrescu <email@hidden>)

  • Prev by Date: Re: user defined error number(s)
  • Next by Date: Re: Quark frustration: setting rule below on paragraphs
  • Previous by thread: Re: On My Mac
  • Next by thread: Re: On My Mac
  • Index(es):
    • Date
    • Thread