Re: Apple Mail syntax for nested folders
Re: Apple Mail syntax for nested folders
- Subject: Re: Apple Mail syntax for nested folders
- From: Håvard Graudo <email@hidden>
- Date: Fri, 06 Jun 2014 09:22:23 +0200
It indeed returns "test/test 2” as the mailbox path - and that is the exact path that fails in my script.:
<snip>
set read status of (every message of mailbox "test/test 2") to true
--> nothing happens. no error, no change of status. just nothing.
<snip>
As others have confirmed, my syntax should have worked so I should probably look elsewhere (a corrupt database or the like)
Thank you for your kind help
Håvard
6. juni 2014 kl. 06:52 skrev Takaaki Naganoya <email@hidden>:
> Hey Håvard,
>
> Check the actual directory of the target Mailbox.
>
> This AppleScript tells you the full path of selected mailbox.
> Try this.
>
> <AppleScrirpt>
> tell application "Mail"
>
> --Get Selected Mailbox
> tell message viewer 1
> set mbList to selected mailboxes
> end tell
>
> set anItem to item 1 of mbList
> set tmpRes to getFullPath(anItem) of me
>
> return tmpRes
>
> end tell
>
> --> "ML/Apple US/AS Related/AppleScript Users"
>
>
> --Mailbox Full Path Text
> on getFullPath(mBox)
> tell application "Mail"
> set aVer to version as number
>
> set fullPath to name of mBox
>
> repeat
> set mBox to getParent(mBox) of me
>
> try
> set aClass to class of mBox
> on error
> exit repeat
> end try
>
> if aVer ≥ 6 then
> --Mountain Lion or later
> if aClass is not equal to container then
> exit repeat
> end if
> else
> --Older Versions
> if aClass is not equal to mailbox then
> exit repeat
> end if
> end if
>
> set aName to name of mBox
> set fullPath to aName & "/" & fullPath
> end repeat
> end tell
>
> return fullPath
> end getFullPath
>
> --Get Parent Mailbox
> on getParent(aMailBox)
> tell application "Mail"
> tell aMailBox
> try
> set a to properties
> set b to container of a
> on error
> return {"", ""}
> end try
> end tell
> end tell
> return b
> end getParent
>
> </AppleScript>
>
> 2014/06/04 21:36、Håvard Graudo <email@hidden> のメール:
>
>> How do I access messages inside nested folders in Apple Mail?
>>
>> I have a folder named “test 2” inside a folder named “test”.
>> What am I doing wrong here:
>>
>> tell application "Mail"
>> set read status of (every message of mailbox "test") to true
>> --> correct. every message status is changed in this folder
>> set read status of (every message of mailbox "test/test 2") to true
>> --> nothing happens. no error, no change of status. just nothing.
>> set read status of (every message of mailbox "test/nonexistingfolder") to true
>> --> correctly errors as there is no such folder
>> end tell
>>
>>
>> OS 10.9.3, Apple Mail 7.3
>>
>> Håvard
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> 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
>
> --
> Takaaki Naganoya
> email@hidden
> http://piyocast.com/as/
>
>
>
>
_______________________________________________
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