Re: Script performance and Safari
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