Passing *possible* variables to a handler
Passing *possible* variables to a handler
- Subject: Passing *possible* variables to a handler
- From: Landis <email@hidden>
- Date: Thu, 11 Jul 2002 17:52:50 -0700
I want to pass a record that may or may not contain certain options
to a handler. This is what I've come up with, please tell me that
I'm overlooking some basic, much easier way to do this. I'm at a
loss.
(I'm also not positive I'm making sense, been staring at a screen too long)
<START SCRIPT>
property defC : 3 --default for C
property defD : 4 --default for D
on ThisHandler(varA, varB, varRec)
if varRec is "" then
set varRec to {varC:defC, varD:defD}
end if
try
set varC to varRec's varC
on error
set varC to defC
end try
try
set varD to varRec's varD
on error
set varD to defD
end try
set ansA to varA
set ansB to varB
set ansC to varC
set ansD to varD
end ThisHandler
ThisHandler(1, 2, "")
--ansA=1
--ansB=2
--ansC=3
--ansD=4
set varRec to {varC:6}
ThisHandler(1, 2, varRec)
--ansA=1
--ansB=2
--ansC=6
--ansD=4
set varRec to {varD:7}
ThisHandler(1, 2, varRec)
--ansA=1
--ansB=2
--ansC=3
--ansD=7
set varRec to {varC:8, varD:9}
ThisHandler(1, 2, varRec)
--ansA=1
--ansB=2
--ansC=8
--ansD=9
<END SCRIPT>
_______________________________________________
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.