Re: Is beep a backdoor?
Re: Is beep a backdoor?
- Subject: Re: Is beep a backdoor?
- From: John W Baxter <email@hidden>
- Date: Tue, 18 Sep 2001 22:21:47 -0700
At 12:10 +1000 9/19/01, Malcolm Fitzgerald wrote:
>
I was debugging a script and came across this oddity. You can hand
>
beep a command and it will perform the task
>
>
beep (close window 1)
>
>
I'd originally typed this line:
>
>
beep -- close window 1
>
>
I had meant to delete "beep --" but only managed to delete the
>
comment markers, Applescript compiled it to "beep (close window 1)"
>
and it runs.
Well, I probably wouldn't have predicted the above, but it does make sense.
1. You can compile pretty much anything that follows the syntax. Although
AppleScript "knows" what's expected, it (usually) doesn't care when
compiling. Exception: boolean parameters provided with the "given name:
value" form are compile into the with or without form:
on spam(ham)
return ham
end spam
spam given ham: true
-- compiles into spam with ham (and fails at run time)
2. AppleScript helps itself with the parentheses when it needs to and can
(beep close isn't legal at the start of a command, but beep (a valid thing
here) is).
3. beep doesn't need a parameter (if it doesn't get one it uses 1).
4. Your result shows that if there is a parameter to beep but it's not a
number, beep ignores it. If it *can* be a number, it is:
beep ("2")
beeps twice; but
beep ("two")
beeps once (same results without the parentheses).
--John
--
John Baxter email@hidden Port Ludlow, WA, USA