• 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: Wait until window is open
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Wait until window is open


  • Subject: Re: Wait until window is open
  • From: BJ Terry <email@hidden>
  • Date: Thu, 20 May 2004 15:50:45 -0700

Hard to say what your problem is, from this information. If your script is timing out on the operation (less likely), you can use a "with timeout" like this:

with timeout 60 seconds
--open window
end timeout

But if the problem is that the window isn't open by the time your script tries to do something with it, you can either poll for the existence of the window, which sucks to do well, or you could just add a delay, like this:

--open window
delay 2
--do stuff with window

I have to do this in at least one of my mail.app scripts, or it fails silently.

BJ


On May 20, 2004, at 2:49 PM, Thierry Lavallie wrote:

Hi,
My script fails if the opening of the window takes too long (open
OriginalPath).

How can I manage for AS to wait until each steps are finished before doing
the next?

Can anyone help?

Thanks!
--
Thierry
PS: OS9


---------------------------------------------------------------
set OriginalPath to "20 Go:F1015.jpg"

set ScaledPath to "20 Go:44_M.jpg"
set myRotate to false
set myAngle to 0 -- angle is CCW

set MaxWidth to 760
set MaxHeight to 500

tell application "GraphicConverter"
activate

set x to (open OriginalPath)
-- THIS PREVIOUS STEP SEEMS TO TAKE TOO LONG

set info to (image dimension of window 1)

set imageWidth to (item 1 of info)
set imageHeight to (item 2 of info)

if imageWidth > MaxWidth or imageHeight > MaxHeight then

if imageWidth  imageHeight then
set myscale to (round (MaxWidth / imageWidth * 10000)) / 10000
else
set myscale to (round (MaxHeight / imageHeight * (10000))) /
10000
-- 10000 will round with 2 decimals
end if

set x to (scale window 1 horizontal myscale vertical myscale)
set x to (sharpen edges of window 1 to 12)

end if
save window 1 in (ScaledPath) as JPEG
close window 1 without saving
end tell

tell me to activate
------------------------------------------------------
_______________________________________________
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.
_______________________________________________
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.


References: 
 >Wait until window is open (From: Thierry LavallĂ©e <email@hidden>)

  • Prev by Date: Re: Indesign CS overriding master page items
  • Next by Date: Re: Wait until window is open
  • Previous by thread: Wait until window is open
  • Next by thread: Re: Wait until window is open
  • Index(es):
    • Date
    • Thread