clone and rename

Ken Ray kray at sonsothunder.com
Sun Dec 19 17:10:28 EST 2004


On 12/19/04 2:13 PM, "Bob Hartley" <rev at armbase.com> wrote:

> Hi All.
> I want create a modify-able file via my application toolbar.exe. So I have
> a toolbar.exe and ask it to call a .rev file fro modification. This file
> will require to be saved. Therefore, I wish to clone a template and rename
> it (immediately rename it) then ask the user to save.
> 
> So the scenario would be....
> 
> open toolbar.exe which gives the options "create new" or "open existing"
> 
> Create new will clone a .rev file eg template.rev and rename it to newname.rev
> 
> I am stuck on the rename section.To clone it I have
> on mouseUp
>    clone stack "bts/template.rev"
> end mouseUp
> 
> I cant find the code to rename it. Can I insert it in the same handler?

When you clone a stack, it creates the clone in memory with no specific file
location. It's also created with a "Copy of <stackName>" name, which you
might want to set as well. You need to set the 'filename' property of the
cloned stack and then save the stack, as in:

on mouseUp
  clone stack "bts/template.rev"
  set the name of it to "MyStack"
  set the filename of stack "MyStack" to "bts/mycopy.rev"
  save stack "MyStack"
end mouseUp

HTH,

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




More information about the use-livecode mailing list