• 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: Script performance and Safari
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Script performance and Safari


  • Subject: Re: Script performance and Safari
  • From: Simon Topliss <email@hidden>
  • Date: Sat, 14 Apr 2012 13:59:31 +0100

On 14 Apr 2012, at 13:52, KOENIG Yvan wrote:

>
> Le 14 avr. 2012 à 13:42, Christopher Stone a écrit :
>
>> On Apr 13, 2012, at 10:07, Mark Ratledge wrote:
>>> Is it possible to increase the performance of this script? It can take 3-4 seconds to run.
>> ______________________________________________________________________
>>
>> I've updated the script with a handler to resize and center the BBEdit window based on a percentile of the screen width.
>>
>> On my i7 MacBook Pro the script takes ~ 0.6 seconds to process this page.
>>
>> Just for fun I rewrote the script (appended) to use the Satimage.osax for find/replace actions and made it a bit faster.  The new script processes the page above in ~ 0.37 seconds.
>>
>> Oh, these times were calculated when the scripts were run from FastScripts.
>>
>> --
>> Best Regards,
>> Chris
>>
>> ------------------------------------------------------------------------------------------------
>> on dateStr()
>> 	tell (current date)
>> 		set d to (its month as number) & (its day as number) & (its year) mod (((its year) div 1000) * 1000)
>> 		set {oldTIDS, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "/"}
>> 		set d to d as text
>> 		set AppleScript's text item delimiters to oldTIDS
>> 		return d
>> 	end tell
>> end dateStr
>> ------------------------------------------------------------------------------------------------
>
> It seems a bit complicated.
>
> Why not :
>
> tell (current date)
> 	return "" & (its month as number) & "/" & its day  & "/" & (its year) mod (((its year) div 1000) * 1000)
> end tell
>
> or
>
> tell (current date)
> 	return "" & (its month as number) & "/" & its day & "/" & text -2 thru -1 of ("" & its year)
> end tell

Even simpler still:

return short date string of (current date)

(Simple) Simon.


 _______________________________________________
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: Script performance and Safari
      • From: Christopher Stone <email@hidden>
    • Re: Script performance and Safari
      • From: KOENIG Yvan <email@hidden>
References: 
 >Script performance and Safari (From: Mark Ratledge <email@hidden>)
 >Re: Script performance and Safari (From: Christopher Stone <email@hidden>)
 >Re: Script performance and Safari (From: Christopher Stone <email@hidden>)
 >Re: Script performance and Safari (From: KOENIG Yvan <email@hidden>)

  • Prev by Date: Re: Script performance and Safari
  • Next by Date: Re: Script performance and Safari
  • Previous by thread: Re: Script performance and Safari
  • Next by thread: Re: Script performance and Safari
  • Index(es):
    • Date
    • Thread