on SAO BtOrFd
choose Pointer Tool
if BtOrFd = "B"
then
put "btn" into ObD
put the Number of btns into ObC
else
put "fld" into ObD
put the Number of flds into ObC
end if
put "select" into SelCmd
repeat with ii = 1 to ObC
put space & ObD && ii && "and" after SelCmd
end repeat
delete last word of SelCmd
put SelCmd into msg
do SelCmd
end SAO
on SAO BtOrFd
choose Pointer Tool
if BtOrFd = "B" then
repeat with i = 1 to the num of btns
set the selected of btn i to TRUE
end repeat
else
repeat with i = 1 to the num of flds
set the selected of fld i to TRUE
end repeat
end if
end SAO
Yes Klaus your way is much shorter and neater - and leaves 'DO' out of the picture so would be faster. But what I particularly liked about Peter's way was his (new to me) use of 'and' that I at first thought wouldn't compile until I tried it and realised it worked!