Re: handler failure [oops! correction]
Re: handler failure [oops! correction]
- Subject: Re: handler failure [oops! correction]
- From: Mike Fischer <email@hidden>
- Date: Thu, 14 Nov 2002 02:55:25 +0100
Hi has,
This script is even more interesting I think as it demonstrates the
internaly indexed properties as well as the diverging my <propertyname>
syntax:
======================================================================
script propertyByIndex
property _01 : missing value
property _02 : missing value
property _03 : missing value
property _04 : missing value
property _05 : missing value
on GetPropertyByIndex(index)
-- Note the my <propertyname> syntax here!
if (index > my _maxProperty) or ,
(index > 5) then
return my _Unkown -- Note the my <propertyname> syntax here!
else if index = 1 then
return _01 -- Here we use the indexed property "feature".
else if index = 2 then
return _02
else if index = 3 then
return _03
else if index = 4 then
return _04
else
return _05
end if
end GetPropertyByIndex
end script
script sTestA
property _A1 : "<A1>"
property _A2 : "<A2>"
property _A3 : "<A3>"
property _A4 : "<A4>"
property _A5 : "<A5>"
-- For laughs comment the next line out, run the script and note the
error message [1]
property _maxProperty : 5
property _Unkown : "???"
property DoTest : missing value
end script
script sTestB
property _B1 : "<B1>"
property _B2 : "<B2>"
property _B3 : "<B3>"
property _B4 : "<B4>"
property _maxProperty : 4
property _Unkown : "???"
property DoTest : missing value
end script
on Initialize()
set sTestA's DoTest to propertyByIndex's GetPropertyByIndex
set sTestB's DoTest to propertyByIndex's GetPropertyByIndex
end Initialize
on run
Initialize()
set s to "#" & tab & "A" & tab & "B" & return ,
& "--" & tab & "----" & tab & "----"
repeat with i from 1 to 6
set s to s & return ,
& (i as string) & tab ,
& (sTestA's DoTest(i)) & tab ,
& (sTestB's DoTest(i))
end repeat
end run
======================================================================
-->
"# A B
-- ---- ----
1 <A1> <B1>
2 <A2> <B2>
3 <A3> <B3>
4 <A4> <B4>
5 <A5> ???
6 ??? ???"
[1] --> Can't make current application into a number.
Now that definitly sounds like a bug to me. I'd really be interested to
know how my _maxProperty was translated to current application.
Mike
--
Mike Fischer Softwareentwicklung, EDV-Beratung
Schulung, Vertrieb
_______________________________________________
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.