在applescript中设置Folder和SubFolder

时间:2014-07-17 06:09:35

标签: outlook applescript eml

所有文件夹& outlook的子文件夹(下面的列表)传入applescript变量(selectedMessages)。

以任何方式逐个传递AppleScript中的所有文件夹(使用applescript)。

outlook邮件文件夹的文件夹结构:

SIGMACO 
   Inbox
     -McAfee Anti-Spam
   Drafts
   Sent Items
   Deleted Items
   Junk E-mail
   RSS Feeds
   Sync Issues
    -Conflicts
    -Local Failures
 ON MY COMPUTER
   Inbox
   Drafts
   Sent Items
   Deleted Items
   Junk E-mail
   archive PST
     -Deleted Items
     -Sent Items
 SMART FOLDERS
   Flagged Mail

+++++++++++

tell application "Microsoft Outlook"
  with timeout of 8.8E+8 seconds
    set selectedMessages to every messagge of folder "deleted Items" of on my coputer
  end timeout
end tell

1 个答案:

答案 0 :(得分:1)

找到列表文件夹和子文件夹的一些代码。

global AllFolders

set AllFolders to {}

global ContainerName

set ContainerName to ""

tell application "Microsoft Outlook"

    set allMailFolders to get mail folders

    repeat with currentFolder in allMailFolders

        set FolderName to name of currentFolder

        set PathSoFar to ""

        if FolderName is not missing value and (container of currentFolder is not missing value or account of currentFolder is not missing value) then

            set ContainerName to ":"

            set theContainer to currentFolder

            repeat while ContainerName is not ""

                set ContainerName to ""

                try

                    set theContainer to container of theContainer

                    set ContainerName to name of theContainer

                    if ContainerName is missing value then

                        set theAccount to account of theContainer

                        if theAccount is not missing value then

                            set AccountName to name of theAccount

                            set PathSoFar to (AccountName) & ":" & PathSoFar

                        end if

                    else

                        set PathSoFar to (ContainerName) & ":" & PathSoFar

                    end if

                end try

            end repeat

            set end of AllFolders to {PathSoFar & ":" & (FolderName)}

        end if

    end repeat

return AllFolders

end tell
相关问题