Page 1 of 1

How to "save as" without problems?

Posted: Sun Nov 29, 2020 8:21 pm
by Francesco77
I am not sure if this is a stupid question and probably I make some mistakes,

I ususally save my projects every hour or so under different names.

For example (with txt-extension):
"myProject-20-11-29a.txt"
"myProject-20-11-29b.txt
etc.

When trying this with my LC projects I get messages that say, that a LC with the same name is already open.
I am not sure why this happens. The normal windows behaviour in this case should be that one can continue to work with the current file under a the new name without problems.

Why does this confusing behaviour happen and how can i avoid it when using "save as"?

Thanks for your help.

Re: How to "save as" without problems?

Posted: Sun Nov 29, 2020 8:38 pm
by SparkOut
The reason is because LiveCode identifies its stacks with the stack's "name" property. This is not the same as the filename. When you "save as" you create a new copy of the project with a new filename, but the stacj "name" doesn't change unless you explicitly change it.
The best way to deal with this is arguable. One simple way is to close LiveCode completely and restart, but it isn't very convenient. If you get a message dialogue asking whether you want to purge the conflicting file from memory then you can. You could try to change the stack name before saving. If I were to ask anyone for more definitive insight, I would go to jacque first.

Re: How to "save as" without problems?

Posted: Sun Nov 29, 2020 11:03 pm
by FourthWorld
I prefer to just keep working and make any backup copies in the file system.

I also copy to a separate volume, in case the problem I encounter is with the disk or the file system.

Now I have that automated: I use Nextcloud with my dev folder syncing to a the machine running Nextcloud. Now I not only get a remote backup each time I save, but they're also versioned and time-stamped so I can roll back to a specific version if needed. Bonus: I also have Nextcloud syncing on my other dev machines, so when I switch among them for testing and tweaking all of them stay in sync. I keep my Plugins folder synced the same way, so my tooling is identical no matter where I'm working.

Re: How to "save as" without problems?

Posted: Mon Nov 30, 2020 8:17 am
by Francesco77
Thank you very much for your answers and help. I think I understand now a bit better how LC works

For solution 1 (closing - copying and restarting):
Is there a way to store the state of the various tools (inspectors etc.) so that they are openend and positioned again when reopening a LC stack? At the moment it seems that I have to do that manually everytime I start LC.

For solution 2 (backing up the openend and running LC file):
Is that possible anytime no matter what is going on in the stack at that moment? I know that storing an openend file can cause a lot of problems in other applications (e.g. MS word etc.).

Re: How to "save as" without problems?

Posted: Mon Nov 30, 2020 8:53 am
by FourthWorld
LC reads an entire stack file into memory, and writes it in one pass. So its I/O is about as clean as it can get.

I've been using copies triggered automatically by save via Nextcloud for many years, and manually copying the stack file for decades before. It works. And quite well.

Re: How to "save as" without problems?

Posted: Mon Nov 30, 2020 6:27 pm
by jacque
I usually do what Richard does, I duplicate the stack in the Finder (Explorer on Windows.) However, there used to be a plugin that auto-saves at intervals you specify. I'm not at my computer right now but check the plugin menu to see if it's still there. That's probably the easiest way to do it.

Edit: Back at the computer now, I see the plugin is still there. It's called revSmartSave. The longest interval it offers is 10 minutes, which may be too often for your workflow.