Page 1 of 1
Renaming a batch of cards
Posted: Sat Feb 26, 2011 1:33 pm
by Glyphs
Hi,
I am a complete beginner and am trying to create an ebook with Livecode. It looks simple enough (at least for now...) but I need a quick way to rename all the cards already created into Page 1, Page 2, etc. For now, the only thing I can do is click a card window, then click the Object>Card Inspector menu to display the Card data in the Inspector Window, change the name, then go to the next card, click the Object>Card Inspector menu to display the Card data in the Inspector Window, change the name, etc. Is there a fastest way or a plug-in to do that more quickly?
Re: Renaming a batch of cards
Posted: Sat Feb 26, 2011 2:13 pm
by Dixie
Glyphs...
To see this work... make a stack and add a number of cards to it... make a button on the first card and add the script below to it... it will then rename each card for you, in this case 'Card 1' ...2,3.. etc.
Code: Select all
on mouseUp
push card
put 1 into count
repeat for (the number of cards) times
set the name of card count to "Card" && count
add 1 to count
end repeat
pop card
end mouseUp
Look in the dictionary for an explanation of 'push' and 'pop'
be well
Dixie
Re: Renaming a batch of cards
Posted: Sat Feb 26, 2011 5:45 pm
by jmburnod
Hi Glyphs,
Welcome in this forum
For rename each cd "Card 1,Card 2 etc...
Code: Select all
on RenameCD1 pName --••pName is a generic name
put the num of cds of this stack into nbCD
repeat with i = 1 to nbCD
set the name of cd i to pName&i
wait 1 milliseconds --•• good for the processor
end repeat
end RenameCD1
For rename each cd from a list of names (tnamesCd in this example)
Code: Select all
on RenameCD2
put "Entry,summary,theme1,theme2"into tnamesCd--••or what you want
repeat with i = 1 to the num of items of tnamesCd
set the name of cd i to(item i of tnamesCd)
wait 1 milliseconds --•• good for the processor
end repeat
end RenameCD2
All the best
Jean-Marc
Re: Renaming a batch of cards
Posted: Sat Feb 26, 2011 6:22 pm
by Glyphs
Thanks Dixie and Jean-Marc:) So, the only way to do this is by programming? No simple button in the interface to just display each card one by one or as a list, and rename all the cards by batch or individually without entering any line of code ? Maybe I should add this as a suggestion to RunRev...
Re: Renaming a batch of cards
Posted: Sat Feb 26, 2011 7:36 pm
by jmburnod
Hi Glyphs,
No simple button in the interface to just display each card one by one or as a list
You can see all cds of stack and substack with the item "Application browser" of the menu "Tools"
Best
Jean-Marc