Re: Can a Creation Date be Modified with ASObjC?
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) |
_______________________________________________
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