on myCoolHandler(someRecord)
set {field1, field2, field3} to checkForFields(someRecord)
if field1 is false then
set report to "there is no field 1"
else
set report to field1
end if
if field2 is false then
set report to report & linefeed & "there is no field 2"
else
set report to report & linefeed & field2
end if
if field3 is false then
set report to report & linefeed & "there is no field 3"
else
set report to report & linefeed & field3
end if
display dialog report
end myCoolHandler
on checkForFields(theRecord)
try
set field1 to get Field_1 of theRecord
on error
set field1 to false
end try
try
set field2 to get Field_2 of theRecord
on error
set field2 to false
end try
try
set field3 to get Field_3 of theRecord
on error
set field3 to false
end try
return {field1, field2, field3}
end checkForFields
set theRecord to {Field_1:"Field 1", Field_2:"Field 2"}
myCoolHandler(theRecord)
on myCoolHandler(someRecord)
try
set field1 to get Field_1 of someRecord
on error
set field1 to false
end try
try
set field2 to get Field_2 of someRecord
on error
set field2 to false
end try
try
set field3 to get Field_3 of someRecord
on error
set field3 to false
end try
if field1 is false then
set report to "there is no field 1"
else
set report to field1
end if
if field2 is false then
set report to report & linefeed & "there is no field 2"
else
set report to report & linefeed & field2
end if
if field3 is false then
set report to report & linefeed & "there is no field 3"
else
set report to report & linefeed & field3
end if
display dialog report
end myCoolHandler
set theRecord to {Field_1:"Field 1", Field_2:"Field 2"}
myCoolHandler(theRecord)
Yvan KOENIG running El Capitan 10.11.1 in French (VALLAURIS, France) lundi 16 novembre 2015 16:15:43