Re: Checking if script is run from login items
Re: Checking if script is run from login items
- Subject: Re: Checking if script is run from login items
- From: Shane Stanley via AppleScript-Users <email@hidden>
- Date: Sat, 22 Aug 2020 15:57:30 +1000
On 22 Aug 2020, at 2:39 am, Jenni via AppleScript-Users
<email@hidden> wrote:
>
> There must be a way to catch this.
I don't believe that's supported for any apps.
> It’s too bad, though, that uptime can’t use the -p or -s options on the Mac —
> they produce an “illegal option” error. It also returns a mixture of letters
> and numbers depending on the time, e.g. "1 hour” or “1:01”, so to parse this
> correctly is a pain.
This will return the value in seconds:
use AppleScript version "2.5" -- macOS 10.11 or later
use framework "Foundation"
use framework "AppKit"
use scripting additions
set upTime to current application's NSProcessInfo's processInfo()'s
systemUptime()
--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>
_______________________________________________
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