Re: Issues subtracting Unix epoch from date
Re: Issues subtracting Unix epoch from date
- Subject: Re: Issues subtracting Unix epoch from date
- From: Nathan Vander Wilt <email@hidden>
- Date: Sat, 20 Feb 2010 15:06:46 -0800
On Feb 20, 2010, at 2:51 PM, Nathan Vander Wilt wrote:
> Here's an equivalent to what I need to do:
>
> 1. Get a date from an application (e.g. tell application "iPhoto" to get date of some photo)
> 2. Store a representation to disk, then exit script
> 3. Time passes, time zone offset may change.
> 4. Start script, load stored representation from disk
> 5. Set the *same* date (or a precise adjustment thereof) back to the application
>
> This is impossible to do with AppleScript's date model. (Or please show how I am wrong?)
-- Heh heh heh
copy (current date) to theDate
tell application "System Events"
local thePlist, theXML
make new property list item with properties {value:theDate}
set thePlist to text of result
make new XML data with properties {text:thePlist}
set theXML to result
get the first XML element of the first XML element of theXML
get value of result
end tell
This is pretty much ridiculous, but it does have the side effect of working. I haven't implemented it yet, but I'm presuming the reverse direction is possible as well. I am considering writing a faceless scriptable Cocoa app to do a more efficient conversion (and one that doesn't rely on a property list item's text to always be XML), but that may be a bit of a pain to deploy.
hope this helps,
-natevw _______________________________________________
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