Re: Don't understand delay action
Re: Don't understand delay action
- Subject: Re: Don't understand delay action
- From: Shane Stanley <email@hidden>
- Date: Wed, 11 Mar 2015 11:20:55 +1100
On 11 Mar 2015, at 2:23 am, Yvan KOENIG <email@hidden> wrote:
I'm surprised by the fact that there is no conflict between the handler named delay and the delay command belonging to AppleScript itself.
In essence there is a conflict. The "delay" command does not belong to AppleScript itself -- it's part of Standard Additions.
Suppose you write a script that addresses an application, and that application uses a term that conflicts with the name of a scripting addition command. The result is that the application's term has precedence, and you can't use the scripting addition command within the app's tell block.
The difference here is that it's the script that's using the terminology, but the result is the same. Here's another example:
beep 3
on beep x set aBeep to "Beep" try -- avoid errors if no argument repeat (x - 1) times set aBeep to aBeep & ", Beep" end repeat end try display alert aBeep giving up after 1 end beep
On 11 Mar 2015, at 2:11 am, Robert Poland <email@hidden> wrote: 2, How come the handler works without the normal parentheses?
That's because it's defined using scripting terminology. It's the same with the open handler:
on open fileList -- do stuff end open
No parentheses there. The same thing also happens if you define terminology in a script library, or use labeled parameters. From the ASLG:
on rock around the clock display dialog (clock as text) end rock 3. Could I add the handler to all scripts that use the delay command?
Yes. Hopefully it doesn't come to that, and the AppleScript team show us some mercy. 4. Would the command “Delay” also call the handler?
That's the whole point of it. |
_______________________________________________
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