Page 1 of 1

Rename labelsbuttons

Posted: Fri Sep 25, 2009 8:33 pm
by JasonTravers
Hi everyone. I am trying to relabel buttons on a card without relabeling each button individually. The find/replace feature doesn't seem to identify the label of a button (or maybe I just don't know how to search! :O)
Is there a line of code I could use in the message box to relabel all of the buttons?
Or am I not finding/replacing properly?

THANKS!
Jason

Posted: Fri Sep 25, 2009 9:26 pm
by bn
Jason,
if I understand you correctly then you want to set the label of all the buttons of a card to the same label?
You can do that by putting this script into the stack script

Code: Select all

on relabelButtons pNewButtonName
   if pNewButtonName is not empty then
      repeat with i = 1 to the number of buttons of this card
         set the label of button i to pNewButtonName
      end repeat
   else
      answer "no new label for the buttons was passed as a parameter" & return & "syntax: relabelButtons " & quote & "myNewLabelName" & quote
   end if
end relabelButtons
You can than invoke this command by typing into the messag box:
relabelButtons "myNewButtonLabel"
If you dont provide a name a dialog appears with the syntax of the command.
The command changes the labels of all the buttons on this one card to "myNewButtonLabel", if you go to the next card you could change the labels of all the buttons of that card and so on.

Of course if you dont want all the buttons to have the same label you would have to check for the label and change it accordingly in the script.
regards
Bernd