• 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: Help! Slow Script!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help! Slow Script!


  • Subject: Re: Help! Slow Script!
  • From: "Arthur J. Knapp" <email@hidden>
  • Date: Tue, 09 Jul 2002 17:20:42 -0400

> From: "Sprague, Graham" <email@hidden>
> Subject: Help! Slow Script!
> Date: Tue, 9 Jul 2002 09:53:33 -0400

> I've written a droplet script that uses Photoshop 7 to extract dimensions
> and create thumbnails which are then placed into a FileMaker File. It all
> works fine but seems so damn slow.

> if rulerUnits contains "inch" then
> set pixelHeight to imageHeight * imageRes
> set pixelWidth to imagewidth * imageRes
> end if
>
> if rulerUnits contains "cm units" then
> set pixelHeight to (imageHeight * 0.3937) * imageRes
> set pixelWidth to (imagewidth * 0.3937) * imageRes
> end if

I don't know how much of an effect on speed it will have, but "else if"
statements are faster than multiple "if" statements:

if rulerUnits contains "inch" then
set pixelHeight to imageHeight * imageRes
set pixelWidth to imagewidth * imageRes

else if rulerUnits contains "cm units" then
set pixelHeight to (imageHeight * 0.3937) * imageRes
set pixelWidth to (imagewidth * 0.3937) * imageRes

else if ...

Doing it the other way, each "if" statement gets evaluated, while using
"else if" statements ensures that the other "conditions" are NOT evaluated
once one of them evaluates to true.

if ( condition1 ) then

-- if we're here, then conditions 2 and 3 won't be evaluated

else if ( condition2 ) then

-- if we're here, then condition 3 won't be evaluated

else

-- etc...

> on populateFileMaker()
>
> tell application "FileMaker Pro"

I'm sure there are some FileMaker Pro scripters on the list who can
help you cut down on the number of AppleEvents sent back and forth.
This is where the real slow down is probably occuring.


P.S. Remember, AppleEvents are our friends, but in great numbers,
they become enemies... ;-)

P.P.S. It feels good to have my email up and running again... :)


{ Arthur J. Knapp, of <http://www.STELLARViSIONs.com>
a r t h u r @ s t e l l a r v i s i o n s . c o m
}
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: RE: Quark syntax for creating a new paragraph with text
  • Next by Date: Re: How does one install scripting additions and Smile 2.4.2 in OS X?
  • Previous by thread: Help! Slow Script!
  • Next by thread: Re: Help! Slow Script!
  • Index(es):
    • Date
    • Thread