Sunday, April 18, 2021

#1 2021-03-24 01:29:22 pm

Petracchi1
Member
Registered: 2021-03-23
Posts: 1

Save Outlook Attachment with Original Creation (or Modification) Date

AppleScript script to Save MS Outlook Attachments Including their Original Creation or Modification Dates in the File Name (On a Mac Computer): I would like to have the script save the attachment so that its file name includes the original date of creation (or modification) of the document (Not the date when I received the attachment), e.g., This_is_my_document_Originally_Created_on_2020_01_01.pdf. Below is the code I've developed so far. Any help would be highly appreciated.

[code]tell application "Microsoft Outlook"
    set msgs to current messages
    set myDocumentFolder to POSIX path of (path to documents folder as string)
    repeat with msg in msgs
        set this_attachment to attachment of msg
        set subj to subject of msg
        set msgSubject to subj as string
        set saveToFolder to myDocumentFolder & msgSubject
        tell application "Finder"
            if not (exists saveToFolder) then
                do shell script "mkdir -p " & quoted form of saveToFolder
            end if
        end tell
        save msg in saveToFolder
        save this_attachment in saveToFolder
    end repeat
end tell[/code]

Model: MacBook Pro 2016
AppleScript: 2.11 (208) (AppleScript 2.7)
Browser: Safari Version 14.0.3 (15610.4.3.1.7, 15610)
Operating System: macOS 10.14

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)