• 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: Axel Luttgens <email@hidden>
  • Date: Fri, 13 Apr 2012 23:41:50 +0200

Le 13 avr. 2012 à 23:13, Alex Zavatone a écrit :

> OK.
>
> Looking at that pointed out a sore spot that I ignored in my past AS programming, the need to occasionally put in a delay and hope that the time delayed was sufficient for the condition to be fulfilled so that the next code will work.
>
> This is inherently craptastic and sloppy, since we are not checking for the real condition to be satisfied before continuing.
>
> So, my question/proposal is, how do we know that the thing we are talking to is in the right state to interact with if we are going to pull the delay?  What classes of things must be waited for and how can we check for them instead of resorting to slapping in a delay of an arbitrary amount?
>
> If we are doing GUI scripting, how do we know if the right window is open and the controls have drawn?

Hello Alex,

Good questions, of course.
There's probably no general answer, just case by case handling.
Without being sure that a subsequent software update won't destroy the subtle arrangement devised to handle a specific case.
But there are some rather unambiguous cases; for example, there should be a way to loop and check the clipboard's contents (or its change) before going further in the program's execution.


> In Chris's example, there is that .1 second delay after copy is selected from the GUI.  How would we know that that action is done and we are ready to proceed with the execution of the next like of code?

Well... depends on many things. ;-)


> Also, I noticed that delay now appears to take a float value as a valid argument.  When did this start being legit?

This came with Mac OS X 10.3.2:

	https://developer.apple.com/library/mac/releasenotes/AppleScript/RN-AppleScript/RN-10_3/RN-10_3.html#//apple_ref/doc/uid/TP40000982-CH103-SW12

Axel




 _______________________________________________
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: 
 >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: Alex Zavatone <email@hidden>)

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