Created
February 22, 2010 18:47
-
-
Save Groxx/311342 to your computer and use it in GitHub Desktop.
Serious weirdness in AppleScript with the "contents" property.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "AppleScript Editor" | |
set d to document 1 | |
set str to "set d to document 1 of AppleScript Editor, and watch the shenanigans. | |
" | |
set str to str & ("d is equal to d == " & (d is equal to d) as text) & " | |
" | |
set str to (str & "d is equal to (contents of d) == " & (d is equal to (contents of d)) as text) & " | |
" | |
set str to str & "d is equal to (contents of (contents of d)) == " & (d is equal to (contents of (contents of d))) as text | |
set str to str & " | |
" | |
set str to str & "Setting d = contents of d... | |
" | |
set str to str & ("d is equal to d == " & (d is equal to d) as text) & " | |
" | |
set str to (str & "d is equal to (contents of d) == " & (d is equal to (contents of d)) as text) & " | |
" | |
set str to str & "d is equal to (contents of (contents of d)) == " & (d is equal to (contents of (contents of d))) as text | |
set str to str & " | |
WTF Apple? Identity function much?" | |
display dialog str | |
(* results: | |
"set d to document 1 of AppleScript Editor, and watch the shenanigans. | |
d is equal to d == true | |
d is equal to (contents of d) == true | |
d is equal to (contents of (contents of d)) == false | |
Setting d = contents of d... | |
d is equal to d == true | |
d is equal to (contents of d) == true | |
d is equal to (contents of (contents of d)) == false | |
WTF Apple? Identity function much?" | |
*) | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment