How to use star in the name of a container
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
How to use star in the name of a container
Hello,
I search a solution for have all button on a card updated in a loop, example below :
In fact I have many button all names started with "btn_U" after I use a number and after I use something.
The goal with the loop is to update every button in a shoot using the * (star)
repeat with tVarCount = 1 to 4
set label of button "btn_U" & tVarCount & "*" to 0
end repeat
My script doesn't work, if you have an idea it could be great.
Thanks Fabrice
I search a solution for have all button on a card updated in a loop, example below :
In fact I have many button all names started with "btn_U" after I use a number and after I use something.
The goal with the loop is to update every button in a shoot using the * (star)
repeat with tVarCount = 1 to 4
set label of button "btn_U" & tVarCount & "*" to 0
end repeat
My script doesn't work, if you have an idea it could be great.
Thanks Fabrice
Re: How to use star in the name of a container
Change it thusly:
This forces evaluation of the "btn_U & i & "*"" FIRST so that the engine just sees button "btn_U1*". If the parens aren't there, the engine expects "to" after "btn_U".
edit: Change the i back to your variable name of course.
Code: Select all
repeat with i = 1 to 4
set the label of button ("btn_U" & i & "*") to 0
end repeat
edit: Change the i back to your variable name of course.
Re: How to use star in the name of a container
Grüezi Fabrice,
let me first see if I understand what you are after
You have for example 4 buttons on your card named:
btn_U1_something_else
btn_U2_a_different_thing
btn_U3_swiss_cheese
btn_U4_chaes_fondue
?
And you want to set their label to the number 0 in a repeat loop without writing their names?
Or dou you mean to set their label to empty?
Whatever, this will not work with "wildcards" like "*"
A "repeat loop" demands correct names!
BUT you could do something like this:
Not tested, but should work (Famous last words
)
Hope this helps.
Best from germany
Klaus
let me first see if I understand what you are after

You have for example 4 buttons on your card named:
btn_U1_something_else
btn_U2_a_different_thing
btn_U3_swiss_cheese
btn_U4_chaes_fondue
?
And you want to set their label to the number 0 in a repeat loop without writing their names?
Or dou you mean to set their label to empty?
Whatever, this will not work with "wildcards" like "*"
A "repeat loop" demands correct names!
BUT you could do something like this:
Code: Select all
...
lock screen
## Now cycle through all buttons on the current card and check their names
repeat with i = 1 to the num of btns of this cd
if the short name of btn i begins with "btn_U" then
set the label of btn i to empty ## or "0"
end if
end repeat
unlock screen
...

Hope this helps.
Best from germany
Klaus
Re: How to use star in the name of a container
Hello,sturgis wrote:Change it thusly:This forces evaluation of the "btn_U & i & "*"" FIRST so that the engine just sees button "btn_U1*". If the parens aren't there, the engine expects "to" after "btn_U".Code: Select all
repeat with i = 1 to 4 set the label of button ("btn_U" & i & "*") to 0 end repeat
edit: Change the i back to your variable name of course.
Thanks for reply. I tried but it doesn't work, error message during execution :
execution error at line 6 (Chunk: no such object) near "btn_U1*", char 17
Fabrice
Re: How to use star in the name of a container
My apologies, misunderstood what you were asking. Go with Klaus and you should be set.
Re: How to use star in the name of a container
Hi Klaus,Klaus wrote:Grüezi Fabrice,
let me first see if I understand what you are after![]()
You have for example 4 buttons on your card named:
btn_U1_something_else
btn_U2_a_different_thing
btn_U3_swiss_cheese
btn_U4_chaes_fondue
?
And you want to set their label to the number 0 in a repeat loop without writing their names?
Or dou you mean to set their label to empty?
Whatever, this will not work with "wildcards" like "*"
A "repeat loop" demands correct names!
BUT you could do something like this:Not tested, but should work (Famous last wordsCode: Select all
... lock screen ## Now cycle through all buttons on the current card and check their names repeat with i = 1 to the num of btns of this cd if the short name of btn i begins with "btn_U" then set the label of btn i to empty ## or "0" end if end repeat unlock screen ...
)
Hope this helps.
Best from germany
Klaus
Thanks, you understand well. it works perfectly with cheese and chocolate

Cheers from Switzerland.
Fabrice
Re: How to use star in the name of a container
No Problem, I was not so clear, but usage of () is interesting also for some other applicationsturgis wrote:My apologies, misunderstood what you were asking. Go with Klaus and you should be set.

Thanks for taking time.
Cheers, Fabrice