How do I delete cloned images with the same name all at once?

Bob Sneidar bobsneidar at iotecdigital.com
Thu Jan 18 10:44:09 EST 2018


Rather use the long id. Just the id means your statement resolves to "delete 456" or some such thing. 

The other thing you can do is rename the clones as soon as you create them so you can reference them later. 

Bob S

> On Jan 17, 2018, at 14:42 , Tore Nilsen via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> 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:
> 
> on mouseUp
> 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 
>  end if
> end repeat
> end mouseUp
> 
>> 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
>> 
>> 
>> 
>> 
>> greetings,
>> 
>> William
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the use-livecode mailing list