Delete a group from within a group script

Ken Ray kray at sonsothunder.com
Tue Apr 8 17:14:21 EDT 2008


On Tue, 8 Apr 2008 21:37:18 +0200, Mark Schonewille wrote:

> Tom,
> 
> if word 1 of the name of the owner of me is "group" then
>   delete group "Group Name" of the owner of me
> end if
> 
> If you are sure that the owner is always a group, you might leave out 
> the if-statement.

You may not be able to do this if the object whose script is currently 
running is part of the group you're deleting. If that's the case, then 
I'd do a quick "send ... in 20 milliseconds" to an object that is not 
in the group being deleted, and run the deletion code from there:

on mouseUp
  put the long id of the owner of me into tGroup
  send "DeleteGroup tGroup" to this card in 20 milliseconds
end mouseUp

-- Card Script
on DeleteGroup pGroup
  delete pGroup
end DeleteGroup

That should work (haven't had a chance to test it though...)


Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/



More information about the use-livecode mailing list