Renaming a batch of cards

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Glyphs
Posts: 7
Joined: Sat Feb 26, 2011 12:17 pm
Contact:

Renaming a batch of cards

Post by Glyphs » Sat Feb 26, 2011 1:33 pm

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?

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Renaming a batch of cards

Post by Dixie » Sat Feb 26, 2011 2:13 pm

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

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Renaming a batch of cards

Post by jmburnod » Sat Feb 26, 2011 5:45 pm

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
https://alternatic.ch

Glyphs
Posts: 7
Joined: Sat Feb 26, 2011 12:17 pm
Contact:

Re: Renaming a batch of cards

Post by Glyphs » Sat Feb 26, 2011 6:22 pm

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...

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Renaming a batch of cards

Post by jmburnod » Sat Feb 26, 2011 7:36 pm

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
https://alternatic.ch

Post Reply