Re: handler failure
Re: handler failure
- Subject: Re: handler failure
- From: Chris Espinosa <email@hidden>
- Date: Tue, 12 Nov 2002 13:38:35 -0800
On Tuesday, November 12, 2002, at 11:37 AM, Paul Skinner
<email@hidden> said, on 11/12/02 11:11 AM:
wrote:
>
repeat 2 times
>
doSomethingCool()
>
end
>
--> one good loop then... +script; doesn't understand the
>
doSomethingCool message.
>
>
on doSomethingCool()
>
set doSomethingCool to "@*%^!!!"
>
end
AppleScript is not Pascal. To return a value from a function, you use
the Return command:
on doSomethingCool()
return "@*%^!!!"
end
What you're doing is replacing the doSomethingCool function with the
string "@*%^!!!". Once that happens, you script consists of a default
Run handler and a string, instead of a default Run handler and a
doSomethingCool() function, so the call to the now-nonexistent function
fails.
A handler is essentially a property in your script, and you can set it
to any value, including that of another function. For example:
on f1()
return 1
end f1
on f2()
return 2
end f2
on temp() -- placeholder
end temp
on run
set temp to f1
set r1 to temp()
set temp to f2
set r2 to temp()
{r1, r2}
end run
Chris Espinosa
Apple
_______________________________________________
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.