[ANSWERED]AppleScript code to get timestamp

Posted on
Mon Feb 16, 2015 11:36 am
davinci offline

[ANSWERED]AppleScript code to get timestamp

Maybe I'm missing some documentation but how can I get the timestamp of the last change of a device (preferably in as a UNIX timestamp)?

Thanks

Posted on
Mon Feb 16, 2015 6:53 pm
jay (support) offline
Site Admin
User avatar
Posts: 18224
Joined: Mar 19, 2008
Location: Austin, Texas

Re: AppleScript code to get timestamp

I'd do it in Python, particularly if you want it in some other format. In AppleScript:

Code: Select all
last changed of device "Your Device Name Here"


That returns an AppleScript date object.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Feb 17, 2015 12:40 am
davinci offline

Re: [ANSWERED]AppleScript code to get timestamp

Thanks. Would you generally suggest to use Python? I now have some external AppleScripts.
What pros and cons I have to consider?

Posted on
Tue Feb 17, 2015 10:34 pm
jay (support) offline
Site Admin
User avatar
Posts: 18224
Joined: Mar 19, 2008
Location: Austin, Texas

Re: [ANSWERED]AppleScript code to get timestamp

I'd always start with Python and only use AppleScript if you have to (need to talk to other Mac apps, etc). AppleScript is the legacy scripting environment and is no longer being advanced.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Feb 18, 2015 3:57 am
davinci offline

Re: [ANSWERED]AppleScript code to get timestamp

Does if matter of I run Python in an external script or in indigo?
(Performance, reliability)

Posted on
Wed Feb 18, 2015 8:15 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: [ANSWERED]AppleScript code to get timestamp

The guidelines are basically:

Indigo Embedded AppleScript Action: blocks main Indigo Server thread, use with caution especially if script may hang/freeze.
Indigo Execute AppleScript File Action: runs in its own process, so can take forever to complete without impacting Indigo Server.

Indigo Python Embedded Script Action: runs in an external process to Indigo Server, but all embedded python scripts share the same process and run sequentially. Therefore, if a script takes longer than 10 seconds to complete then Indigo Server may terminate it.
Indigo Execute Python File Action AND Indigo Plugins: runs in their own processes and can run indefinitely.

Image

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 16 guests