Results 1 to 5 of 5

Thread: Applescript to Edit Date Created and Date Modified

  1. #1

    Default Applescript to Edit Date Created and Date Modified

    Hi Michael,

    I'm giving the trial of EagleFiler a shot, and am wondering if there is the Date Created and Date Modified Fields are editable via Applescript.

    I'm trying to transfer a bunch of files from Scrivener to EagleFiler. Scrivener doesn't appear to preserve the created/modified dates when exporting files to Finder.

    All of my filenames begin with the date in the form "2011.02.27 - Title Here, Hyaa". I want to use an applescript to go through each file, read the date at the front of the file name, and use it for the Date Created and Date Modified fields. I did a quick search of your forums and applescript page, but couldn't find what I was looking for.

    Thanks. Sam.

  2. #2

    Default

    Quote Originally Posted by sammy View Post
    I'm giving the trial of EagleFiler a shot, and am wondering if there is the Date Created and Date Modified Fields are editable via Applescript.
    They are. There's an example of this in the Web archive to PDF script.

    Quote Originally Posted by sammy View Post
    All of my filenames begin with the date in the form "2011.02.27 - Title Here, Hyaa". I want to use an applescript to go through each file, read the date at the front of the file name, and use it for the Date Created and Date Modified fields.
    Yes, this definitely sounds like something that could be done with AppleScript.

  3. #3

    Default

    Great - thanks, Michael. I'll check out the script you mentioned and see what I can come up with.

  4. #4

    Default

    Quote Originally Posted by sammy View Post
    Great - thanks, Michael. I'll check out the script you mentioned and see what I can come up with.
    FYI, I find that creating new date objects in AppleScript is a bit confusing because if you write:

    Code:
    date "1/3/1977"
    it will only work on Macs that are set to use that date format. So if you are creating a date programmatically, you might want to do something like:

    Code:
    set _date to current date
    set year of _date to 1977
    set month of _date to 1
    set day of _date to 3

  5. #5

    Default

    Hi Michael,

    Thanks for that.

    I adapted a script I'd written ages ago for Mori which I've attached below if you or anybody else wants to use it. It seems to work so far, though my testing's been limited. Please feel free to improve/modify/clean it up, as I'm relatively new to scripting and just sort of cobble stuff together with the help of examples I find here and there.

    Thanks. Sam.

    = = = = = = = = = = = = = = = = = = =

    ------FOR ENTRIES (IN SELECTED ENTRIES) THAT BEGIN WITH A DATE (IN THE FORM 2011.05.15), COERCE THEIR CREATION & MODIFICATION DATES TO THE DATE CONTAINED IN THE TITLE

    tell application "EagleFiler"
    set theRecords to selected records of browser window 1
    repeat with theRecord in theRecords
    set theTitle to theRecord's title
    try
    set theDate to (characters 6 thru 7 of theTitle) & "." & (characters 9 thru 10 of theTitle) & "." & (characters 1 thru 4 of theTitle) as string
    set theDate to my date theDate
    set theRecord's creation date to theDate
    set theRecord's modification date to theDate
    end try
    end repeat
    end tell

Similar Threads

  1. Date Modified gets date of import
    By khe91 in forum EagleFiler
    Replies: 7
    Last Post: 09-05-2017, 09:43 AM
  2. change date format?
    By wagnerone in forum EagleFiler
    Replies: 2
    Last Post: 09-04-2009, 01:41 PM
  3. Creation date modified using iDisk
    By j-tummins in forum EagleFiler
    Replies: 4
    Last Post: 08-23-2009, 04:37 PM
  4. "Date Created" as view and sort option
    By Steve J in forum EagleFiler
    Replies: 2
    Last Post: 03-11-2008, 02:43 PM
  5. Sort by date bug?
    By brab in forum EagleFiler
    Replies: 4
    Last Post: 02-20-2007, 01:43 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •