Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How many seconds since I logged in



>> How can I construct an Applescript that will tell how many seconds it has
>> been
>> since I logged in? I've completely lost my bearings on a way to search for
>> this.
> 
> Not seconds, but this will get you a string with a date/time in it.
> (This is what I use for an 'on since' stamp, anyway.)
> 
> set the_user to the second word of ¬
>     (characters (offset of "Users" in path to preferences as string) ¬
>         through (length of (path to preferences as string)) of ¬
>         (path to preferences as string) as string)
> set onSinceLine to paragraph 3 of (get do shell script "finger " & the_user)
> 
> (I may be inappropriately mixing string types here, but I haven't had any
> problems using this to get a string. I'm staying clear of the 'string types'
> discussions on related lists. ;)
> --

A shortcut for this:

do shell script "uptime"

If you don't mind portability, you can also use Jon's Commands' "the ticks"
(elapsed 1/60 seconds since startup) command or "GetMilliSec" (elapsed
1/1000 seconds since startup). Google for it or take a look to
<http://www.osaxen.com/>.


jj

* I'm pretty sure, though, you can find here someone to tell you the "call
method" formula using the "NSDate" thingie.

-- 
http://www.macscripter.net/
http://www.osaxen.com/


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden

This email sent to email@hidden

References: 
 >Re: How many seconds since I logged in (From: "Gary (Lists)" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.