• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Checking if script is run from login items
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Checking if script is run from login items
      • From: Jenni via AppleScript-Users <email@hidden>
References: 
 >Checking if script is run from login items (From: Jenni via AppleScript-Users <email@hidden>)
 >Re: Checking if script is run from login items (From: llee040 via AppleScript-Users <email@hidden>)
 >Re: Checking if script is run from login items (From: Jenni via AppleScript-Users <email@hidden>)

  • Prev by Date: Re: Checking if script is run from login items
  • Next by Date: Re: Checking if script is run from login items
  • Previous by thread: Re: Checking if script is run from login items
  • Next by thread: Re: Checking if script is run from login items
  • Index(es):
    • Date
    • Thread