• 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: Can a Creation Date be Modified with ASObjC?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can a Creation Date be Modified with ASObjC?


  • Subject: Re: Can a Creation Date be Modified with ASObjC?
  • From: Shane Stanley <email@hidden>
  • Date: Mon, 27 Jun 2016 10:04:10 +1000

On 27 Jun 2016, at 8:27 AM, Christopher Stone <email@hidden> wrote:

Can a Creation Date be Modified with ASObjC?

It seems likely, but I can't find any references to the method on Google.

Sure. This requires 10.11 for the built-in bridging of the AS date to an NSDate; for 10.10 you'd need to use a handler to do the conversion.

use AppleScript version "2.5"
use framework "Foundation"
use scripting additions

set thePath to POSIX path of (choose file)
set theDate to current date
set theURL to current application's |NSURL|'s fileURLWithPath:thePath
set {theResult, theError} to theURL's setResourceValue:theDate forKey:(current application's NSURLCreationDateKey) |error|:(reference)
if theResult as boolean is false then error (theError's localizedDescription() as text)

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

 _______________________________________________
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

  • Follow-Ups:
    • Re: Can a Creation Date be Modified with ASObjC?
      • From: Christopher Stone <email@hidden>
    • 10.11 additions to NSAppleEventDescriptor & Mac App Store
      • From: Stephen Cronin <email@hidden>
References: 
 >Can a Creation Date be Modified with ASObjC? (From: Christopher Stone <email@hidden>)

  • Prev by Date: Can a Creation Date be Modified with ASObjC?
  • Next by Date: 10.11 additions to NSAppleEventDescriptor & Mac App Store
  • Previous by thread: Can a Creation Date be Modified with ASObjC?
  • Next by thread: 10.11 additions to NSAppleEventDescriptor & Mac App Store
  • Index(es):
    • Date
    • Thread