Multi Commander Support Forum
Multi Commander => Script => Topic started by: matm on May 14, 2012, 10:59:20
-
Hello
I have some use cases where i need to create empty text files. I would like to have a button/shortcut for that.
My workflow will be:
- Set the explorer panel in the folder
- Click the button
* Create an empty text file and put it in rename mode, as it bahevaes currently when using right-click/New/Text Document
-
Maybe this script will be useful
@var $s = AskText("Enter file name", "New file.txt", 0);
$s = GetSourcePath() + $s;
SaveStringToFile($s, "", 0);
It asks you for the file name and then creates empty file. But if a file already exists, it will be overwritten.
-
Unfortunately I do not think there is a way I set the file into rename mode after that.
Calling one of the internal commands from script would solve that. I been planing to add something like that. I will see if I can add that in the next version.
If you just want to create an empty file you can also write "cf <filename>" in the commandline field. Then an empty file with the given name is created in the current location.
-
Unfortunately I do not think there is a way I set the file into rename mode after that.
Maybe activating in-place rename is not possible, but another way is to use custom command
MC.Filesystem.Rename ASKNAME
-
Thanks for all answers,
I will check that on Friday.
TY
-
I wanted to post the same suggestion or question, where or how can I create an empty text file in MC. In my previous file manager it was possible with keys combination like SHIFT+F4 but here it doesn't work. This keys combination is very fast and useful. Do you plan to add something like that to next version of Multi Commander? The same is how to copy file into the same folder but with different file name. In my previous manager it was combination SHIFT+F5. These two options I used very often.
Thanks.
Dusan
-
Shift+F5 (might be something other, depends on default style, men look in menu > file )
will copy the select file to the same folder and will suggest a name that is same as original with ".bak" appended
To create a empty file fast. You can type "cf <filname>" in the commandline field.
-
I use the following script to create a new text file in active explorer panel:
However, I have to press F2 manually to rename it.
MC.RunCmd ID=ExplorerPanel.51002 seems to execute before MC.CmdLineRun can complete!.
Is MC.CmdLineRun ASYNCHRONOUS?
@var $File = "New";
@var $Ext = ".txt";
@var $Part = $File + $Ext;
@var $Full = GetSourcePath() + $File + $Ext;
@var $nStr;
@var $n = 1;
while( $n > 0 )
{
// Break loop if target filename does not exist
if( GetFileTime( $Full ) == 0 )
{
break;
}
// Otherwise increment filename and loop
$nStr = numtostr($n);
$Part = $File + " [" + $nStr + "]" + $Ext;
$Full = GetSourcePath() + $Part;
$n++;
}
MC.Explorer.Selection.UnselectAll;
MC.CmdLineRun CMD="cf {$Part}";
// MC.RunCmd ID=ExplorerPanel.51002
-
MC v3.2.0 supports creating new file (Shift+F4 by default) and it uses internal file associations.