(beep) as string
(beep) as string
- Subject: (beep) as string
- From: Nigel Garvey <email@hidden>
- Date: Mon, 17 Nov 2003 10:51:00 +0000
"Fredo d;o)" posted this line in a script on bbs.applescript.net
yesterday:
display dialog "The required label does not exist..." & (beep) with
icon 0
The non-result from (beep) is being concatenated onto a string, which
shouldn't be possible. It can also be concatenated *into* a string and
still work:
set msg to "The required label " & (beep) & "does not exist..."
It appears that a non-result from any call can be reliably coerced to an
empty string, provided that it's done "in the same breath" (not via a
result).
on fred()
end fred
fred() as string
--> ""
fred()
result as string
--> error
A non-result can also be coerced to an empty list, but not so reliably.
With AS 1.3.7 (OS 8.6), the list appears in Script Editor's Result
window, but isn't visible to the script itself. With AS 1.8.3 and 1.9.1,
the list *is* usable in the script. But it's not an empty list: it's a
list containing a non-result!
set aardvark to (activate) as list
--> {}
count aardvark
--> 1
set end of aardvark to Tuesday
--> {, Tuesday}
Having written this all out, I'm now convinced that the ability to coerce
non-results - either to list or to string - is a bug. But I promised I'd
ask about it here. :-)
In response to the sensation caused by his (beep) trick, Fredo also
posted this:
tell application "Finder" to display dialog "" & (name of (choose file
(beep (activate)))) with icon 1
Although it's very unconventional to use commands that don't return
results as parameters to commands that don't need them, I'm not sure that
any bug is involved here. Would anyone care to comment?
NG
_______________________________________________
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.