How do I delete cloned images with the same name all at once?
tore.nilsen at me.com
Wed Jan 17 17:42:28 EST 2018
The property “name” refers to more than “ticket”, it also includes the description of the control, in your case the name will be “image ticket”.
You also will need to count down from the number of images in order to delete all of them, otherwise you will run into a situation where x is higher than the number of images still on your card
Use short name instead of name, this will script will work:
put the number of images of this card into tImages
repeat with x = tImages down to 1
if the short name of image x = “ticket” then
delete image x
> 17. jan. 2018 kl. 23:25 skrev William de Smet via use-livecode <use-livecode at lists.runrev.com>:
> Hi there,
> I have several cloned images and all have the same name: ticket.
> Of course there ID is different.
> On close card I want to delete them.
> How do I delete them all at once?
> Wat is wrong with this code?
> on mouseup
> repeat with x= 1 to the number of images of this card
> if the name of image x is "ticket" then put the ID of image x into GONE
> end repeat
> send ("delete GONE") to me in 0 ticks
> end mouseup
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the use-livecode