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