Hi Rob,
Code: Select all
command herstelindex
put number of cards into tNum
repeat with i=1 to tNum
put line i of fld "index" into tInd
put label of button "pagnam" of cd tInd into tVar
put tVar & cr after fld "index"
end repeat
sort lines of fld "index"
end herstelIndex
This will only work if the number of lines of fld "index" is really the number of cards.
But with this script, this is not the case, because it will have an empty line in it,
caused by the last CR that our are adding.
and you do not completely replace the text of fld "index" so all your cards may appear several times in that field!
Not sure what exactly you are trying to do, but if you want a list of all your card names in the field "indx" (and thus
as the label of your button "pagnum") I would suggest to use "the cardnames" of stack XYZ
Try something like this, using the actualy card names as the "references" and NOt the content of fld "index":
Code: Select all
command herstelindex
put the cardnames of this stack into tListOfCards
## Do not access fields in a a repeat loop, that will slow down the thing! Use a variable first and then put it into the field:
put empty into tIndex
repeat for each line tCard in tListOfCards
put the label of button "pagnam" of cd tCArd into tVar
put tVar & cr after tIndex
end repeat
## Now get rid of trailing CR!!!
delete char -1 of tIndex
sort tIndex
put tIndex into fld "index"
## or maybe AFTER fld "index" if you really want to :-)
end herstelIndex
But maybe I misunderstood you completely
Best
Klaus