• 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: Position of an element in a list
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Position of an element in a list


  • Subject: Re: Position of an element in a list
  • From: Shane Stanley <email@hidden>
  • Date: Fri, 4 Aug 2017 10:04:51 +1000

On 4 Aug 2017, at 7:10 am, Jim Underwood <email@hidden> wrote:
>
> As I understand it from Chris (can be confirmed or corrected by Shane), this
> timer consumes the least about of overhead that one could obtain in
> AppleScript.

Probably.

> It other words, the time reported can be safely attributed to your script.

Not necessarily. If you're running the script in a script editor, depending on
the code, there can be overhead because of the Apple event callbacks added.

Here's a simple example:

use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use scripting additions

set theDate to current application's NSDate's |date|()
do shell script "echo 'abc'"
do shell script "echo 'abc'"
do shell script "echo 'abc'"
do shell script "echo 'abc'"
do shell script "echo 'abc'"
do shell script "echo 'abc'"
do shell script "echo 'abc'"
do shell script "echo 'abc'"
do shell script "echo 'abc'"
set theDif to theDate's timeIntervalSinceNow()
display dialog (-theDif as text)

Run it half a dozen times, then save it as an applet and run the applet a few
times. What's the "correct" answer?

(There's also an issue where 10.10 and earlier where the precision of floating
point numbers was truncated.)

--
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

References: 
 >Re: Position of an element in a list (From: "Nigel Garvey" <email@hidden>)
 >Re: Position of an element in a list (From: Shane Stanley <email@hidden>)
 >Re: Position of an element in a list (From: Jim Underwood <email@hidden>)
 >Re: Position of an element in a list (From: Shane Stanley <email@hidden>)
 >Re: Position of an element in a list (From: Jim Underwood <email@hidden>)
 >Re: Position of an element in a list (From: Shane Stanley <email@hidden>)
 >Re: Position of an element in a list (From: Jim Underwood <email@hidden>)
 >Re: Position of an element in a list (From: Jim Underwood <email@hidden>)

  • Prev by Date: Re: Position of an element in a list
  • Next by Date: [ANN] Spotlight metadata library
  • Previous by thread: Re: Position of an element in a list
  • Next by thread: Re: Position of an element in a list
  • Index(es):
    • Date
    • Thread