"result" corruption
"result" corruption
- Subject: "result" corruption
- From: Steven Angier <email@hidden>
- Date: Mon, 29 Jul 2002 18:12:42 +1000
- Organization: Macscript.com
The following code (example 1) demonstrates how the implicit variable
"result" can be corrupted. It seems that this has something to do with
alias coercion, as I haven't been able to replicate the effects with
other classes (see example 2). Mac OS 9.2.1 / AS 1.8.3.
-- Example 1 ------------------------------------------------------
get (((path to system folder) as text) & "Preferences")
if VerifyFile(result & ":") then
set theResult to (result & ":")
else
set theResult to result
end if
return theResult
--> {alias "HD1:System Folder:Preferences:", ":"}
on VerifyFile(theFile)
try
--make sure file exists or trigger error
get (theFile as text) as alias
return true
on error
return false
end try
end VerifyFile
-- Example 2 ------------------------------------------------------
get "1.5"
if CouldBeInteger(result) then
return result as integer
else
return result
end if
on CouldBeInteger(theValue)
try
get (theValue as number) as integer
return true
on error
return false
end try
end CouldBeInteger
----
Steven Angier
Macscript.com
_______________________________________________
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.