Script control tool.
Posted: Fri Apr 23, 2021 4:13 pm
I have an idea that someone could make a tool that would control all the extra tools that is added to Moho.
From:
https://forums.cockos.com/showthread.php?t=231020
------------------------------------------------------------------
One of the cool things I love about hacking stuff is: You have a totally ridiculous idea and...you try it out anyway.
So yesterday, I had such a ridiculous idea. "If zip-archives add the path of a file into their filename...what if the operating system does as well?
And what happens, if I use that assuption with os.rename?"
So that's what I did and I discovered, that you can not only rename files with
os.rename("oldfilename.txt", "newfilename.txt")
you can also move files with it, by replacing the old path with the new one:
os.rename("c:\\oldfilename.txt" "c:\\temp\\oldfilename.txt")
and the great thing about it, you can do this also for directories.
So if you need a way of moving a file, without having to copy it first and manually delete the old one: use os.rename.
Another thing: You can NOT overwrite already existing files/directories, so check, if os.rename returns false!
Works on Mac and Windows, haven't checked Linux yet.
-------------------------------------------------------------------
So what would happen if one were to have the custom content folder at c:\
and have a disable folder in tool? Where the a tool would open both tool and disable folders and allow one to move tools from one folder to the other?
Also there would be a white board of tools that don't move in the tool itself.
You would have to close Moho and restart, but all the tools you need would be there.
https://www.dropbox.com/s/okgnrnmpeb1r8 ... l.png?dl=0
Dale
From:
https://forums.cockos.com/showthread.php?t=231020
------------------------------------------------------------------
One of the cool things I love about hacking stuff is: You have a totally ridiculous idea and...you try it out anyway.
So yesterday, I had such a ridiculous idea. "If zip-archives add the path of a file into their filename...what if the operating system does as well?
And what happens, if I use that assuption with os.rename?"
So that's what I did and I discovered, that you can not only rename files with
os.rename("oldfilename.txt", "newfilename.txt")
you can also move files with it, by replacing the old path with the new one:
os.rename("c:\\oldfilename.txt" "c:\\temp\\oldfilename.txt")
and the great thing about it, you can do this also for directories.
So if you need a way of moving a file, without having to copy it first and manually delete the old one: use os.rename.
Another thing: You can NOT overwrite already existing files/directories, so check, if os.rename returns false!
Works on Mac and Windows, haven't checked Linux yet.
-------------------------------------------------------------------
So what would happen if one were to have the custom content folder at c:\
and have a disable folder in tool? Where the a tool would open both tool and disable folders and allow one to move tools from one folder to the other?
Also there would be a white board of tools that don't move in the tool itself.
You would have to close Moho and restart, but all the tools you need would be there.
https://www.dropbox.com/s/okgnrnmpeb1r8 ... l.png?dl=0
Dale