• 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: Mail scripting…
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mail scripting…


  • Subject: Re: Mail scripting…
  • From: Axel Luttgens <email@hidden>
  • Date: Tue, 8 Apr 2008 18:05:21 +0200

Le 7 avr. 08 à 18:54, awaw a écrit :

I'm coming back…

Your solution is perfect if you know the name of the mbox (here "nubian/scripting") and write it explicitly in the script.

But I don't succeed in a script to know the fact that "scripting" is a sub folder of "nubian".
Is it possible?


How can I get this "property" and use it to construct dynamically the name of the mbox and reach
for example "Society/Computer/Apple" and then continue the script as under with "tell mailbox mbox"


There is a pseudo-code to illustrate my thinking.

 set xx to name of mailbox         -- "Society"
 If society has a subfolder then
     get name of that subfoder     -- "Computer"

set xx to xx & "/" & result -- "Society/Computer"
…/…
set mbox to xx -- "Society/Computer/ Apple"
tell mailbox mbox
…/…


Thanks for your help

Part of the problem is that application's element "mailboxes" returns all user's mailboxes in a bunch; by contrast, an application's property such as "outbox" returns a top-level mailbox, that may then be explored in a systematic way.


Here follows an attempt:

	tell application "Mail"
		-- Fetch the user's top-level mailboxes.
		set TLMBoxes to mailboxes whose its name of container is missing value
		-- Explore those mailboxes.
		repeat with MBox in TLMBoxes
			my HandleMbox(MBox)
		end repeat
	end tell

	on HandleMbox(MBox)
		local Msg, SubMBox
		tell application "Mail"
			-- Do something with the mailbox
			name of MBox
			-- Do something with the mailboxe's messages, if any
			--repeat with Msg in messages of MBox
			--	sender of Msg
			--end repeat
			-- Do something with the mailboxe's mailboxes, if any
			repeat with SubMBox in mailboxes of MBox
				my HandleMbox(SubMBox)
			end repeat
		end tell
	end HandleMbox

Above procedure could easily be extended so as to make use of names (such as in: mailbox "Society/Computer/Apple").

But I'm not sure every conceivable case will be handled that way...

HTH,
Axel _______________________________________________
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: 
 >Re: Mail scripting… (From: awaw <email@hidden>)

  • Prev by Date: Re: One Finder and one iTunes Question?
  • Next by Date: finder authenticate
  • Previous by thread: Re: Mail scripting…
  • Next by thread: Re: Mail scripting…
  • Index(es):
    • Date
    • Thread