That looks an works very well.
One thing I learned the hard way: Scripts can be password protected
I modified your script to guard against that. Of course other solutions are also possible.
Code: Select all
command getObejcts stackRuggedID, @pObjectListA -- build array with objects & scripts of each stack
local tStack, tCard, tControlID, tCardIDs
//stack
put stackRuggedID into tStack
put the long name of stackRuggedID into pObjectListA[tStack]["longOwner"]
put the short name of stackRuggedID into pObjectListA[tStack]["owner"]
try
put the script of stackRuggedID into pObjectListA[tStack]["script"]
catch e
if e contains "564" then ## password protected
put "password protected" into pObjectListA[tStack]["script"]
else
put "error: " & line 1 of e into pObjectListA[tStack]["script"]
end if
end try
//cards
-- repeat with x =1 to the number of cards of stackRuggedID
put the cardIDs of tStack into tCardIDs
repeat for each line tCardID in tCardIDs
put revRuggedID(the long id of card id tCardID of tStack) into tCard
put the long id of tCard into pObjectListA[tCard]["longOwner"]
put the short name of tCard into pObjectListA[tCard]["owner"]
try
put the script of tCard into pObjectListA[tCard]["script"]
catch e
if e contains "564" then ## password protected
put "password protected" into pObjectListA[tCard]["script"]
else
put "error: " & line 1 of e into pObjectListA[tCard]["script"]
end if
end try
// controls
repeat with y = 1 to the number of controls of tCard
put revRuggedID(the long id of control y of tCard) into tControlID
put the long name of tControlID into pObjectListA[tControlID]["longOwner"]
put the short name of tControlID into pObjectListA[tControlID]["owner"]
try
put the script of tControlID into pObjectListA[tControlID]["script"]
catch e
if e contains "564" then ## password protected
put "password protected" into pObjectListA[tControlID]["script"]
else
put "error: " & line 1 of e into pObjectListA[tControlID]["script"]
end if
end try
end repeat
end repeat
end getObejcts
Bernd