News:

MultiCommander v16.6 is released!

Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - mlabrkic

#1
Multi Commander - Choose Neovim "Stable" or "Test" Config

This story was originally published:
https://mlabrkic.github.io/posts/2025/2025_09m_15-multicommander-nvim_appname/

I also copied to:
https://medium.com/@m1brkic23

This is the modern way of selecting the Neovim config folder by setting the NVIM_APPNAME environment variable!

Check in Neovim:
:h NVIM_APPNAME, :echo $NVIM_APPNAME, :echo stdpath("config"), and :echo stdpath("data")

Info (Multi Commander: Run the Neovim GUI): https://forum.multicommander.com/forum/index.php/topic,4835.0.html

############################################################

1. First of all, do this

Copy the Neovim "TEST" configuration to the "nvimt" folder: C:\Users\<you>\AppData\Local\nvimt
Then run the "Neovim-neovide-TEST" MultiScript (F11) in the "Multi Commander".

These are my folders (stable and test):

C:\Users\<you>\AppData\Local\
nvim
nvim-data

nvimt
nvimt-data

############################################################

2. I am now using these Multi Commander scripts


F10
Neovim-neovide-STABLE
Command type: Multi-Script

@var $selectedFile = GetSelectedPaths();
@var $fileDir = PathGetPathPart($selectedFile, 1);

// @var $app = "neovide --neovim-bin=C:\\UTILS\\Neovim\\bin\\nvim";
// I have Neovim folder in Windows path: C:\UTILS\Neovim\bin\
@var $app = "neovide";

MC.Run CMD={$app} ARG={$selectedFile} STARTIN={$fileDir}

------------------------------
F11
Neovim-neovide-TEST
Command type: Multi-Script

@var $selectedFile = GetSelectedPaths();
@var $fileDir = PathGetPathPart($selectedFile, 1);

// MC.Run CMD="cmd.exe" ARG="/k set NVIM_APPNAME=nvimt&neovide "{$selectedFile} STARTIN={$fileDir}
// MC.Run CMD="cmd.exe" ARG="/c set NVIM_APPNAME=nvimt&neovide "{$selectedFile} STARTIN={$fileDir}

// start cmd shell, start neovide from cmd, and immediately close the cmd window
MC.Run CMD="cmd.exe" ARG="/c set NVIM_APPNAME=nvimt&&start neovide "{$selectedFile} STARTIN={$fileDir}

------------------------------
F12
Neovim-neovide-STABLE-without-file
Command type: Multi-Script

// STABLE configuration without an initial file

@var $selectedFile = GetSelectedPaths();
@var $fileDir = PathGetPathPart($selectedFile, 1);

// @var $app = "neovide --neovim-bin=C:\\UTILS\\Neovim\\bin\\nvim";
// I have Neovim folder in Windows path: C:\UTILS\Neovim\bin\
@var $app = "neovide";

MC.Run CMD={$app} STARTIN={$fileDir}


############################################################

3. Info - TEST configuration with "Windows PowerShell"


F11
Neovim-neovide-TEST
Command type: Multi-Script

// TEST configuration with "Windows PowerShell"

@var $selectedFile = GetSelectedPaths();
@var $fileDir = PathGetPathPart($selectedFile, 1);

MC.Run CMD="powershell.exe" ARG="-WindowStyle Hidden -Command $env:NVIM_APPNAME='nvimt';Start-Process neovide "{$selectedFile} STARTIN={$fileDir}


############################################################

Windows has two command-line shells: the Command shell and PowerShell.
https://learn.microsoft.com/en-us/powershell/scripting/overview

Windows Commands:
https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/windows-commands
or
https://ss64.com/nt/

Windows CMD Shell syntax and START command:

Windows CMD Shell How-to guides and examples https://ss64.com/nt/syntax.html
START https://ss64.com/nt/start.html

Try this:
Run Command shell (Win-s: run, press Enter): cmd.exe
START "Demo 1" nvim
START neovide
#2
Script / Multi Commander: Run the Neovim GUI
September 02, 2024, 15:52:05
Multi Commander: Run the Neovim GUI (F10)

1. nvim-qt
2. goneovim

3. neovide (I am now using this Neovim GUI.)
https://github.com/mlabrkic/mykickstart.nvim/tree/master/lua/custom/gui


############################################################

1.
nvim-qt


@var $selectedFile = GetSelectedPaths();
@var $fileDir = PathGetPathPart($selectedFile, 1);
@var $app = "C:\\UTILS\\Neovim\\bin\\nvim-qt.exe";
MC.Run CMD={$app} ARG={$selectedFile} STARTIN={$fileDir}



2.
goneovim


@var $selectedFile = GetSelectedPaths();
@var $fileDir = PathGetPathPart($selectedFile, 1);
@var $app = "goneovim --nvim=C:\\UTILS\\Neovim\\bin\\nvim.exe";
MC.Run CMD={$app} ARG={$selectedFile} STARTIN={$fileDir}



3.
neovide
(I am now using this Neovim GUI.)


@var $selectedFile = GetSelectedPaths();
@var $fileDir = PathGetPathPart($selectedFile, 1);
@var $app = "neovide --neovim-bin=C:\\UTILS\\Neovim\\bin\\nvim";
MC.Run CMD={$app} ARG={$selectedFile} STARTIN={$fileDir}


#3
Script / Re: Choose the Neovim configuration
December 21, 2022, 10:03:27
Before using this script, you should make a backup of the Neovim config folder.

Be sure to "exit" Neovim, and only then run this script!
As I remember, Neovim config folder was deleted a couple of times...
#4
Script / Choose the Neovim configuration
April 12, 2022, 12:34:13
Choose the Neovim configuration:  stable config or test config

------------------------------------------------------------
What to do? Where to install Neovim?

------------------------------
Install Neovim in a folder C:\UTILS\Neovim\

1. Download:
https://github.com/neovim/neovim/wiki/Installing-Neovim#install-from-download
Latest stable release

Assets 12:
nvim-win64.zip


2. Install (Windows):
https://github.com/neovim/neovim/wiki/Installing-Neovim
Unzip the package (nvim-win64.zip).

Run nvim-qt.exe
C:\UTILS\Neovim\bin\nvim-qt.exe

Create a stable configuration!

------------------------------
1)
First, rename the folders (stable config):
C:\Users\username\AppData\Local\nvim\
C:\Users\username\AppData\Local\nvim-data\

to
C:\Users\username\AppData\Local\nvim1\
C:\Users\username\AppData\Local\nvim-data1\

Note:  C:\Users\username\AppData\ , it is a hidden folder

You can insert a blank Neovim-stable-config.txt file  into both folders (for labeling purposes).

------------------------------
2)
Second:
Run nvim-qt.exe

Create a test configuration

Then, rename the folders (test config):
C:\Users\username\AppData\Local\nvim\
C:\Users\username\AppData\Local\nvim-data\

to
C:\Users\username\AppData\Local\nvim2\
C:\Users\username\AppData\Local\nvim-data2\

------------------------------------------------------------
for example
I am currently using a test configuration:

C:\Users\<username>\AppData\Local\

nvim  (Symlink to folder nvim2)
nvim1
nvim2

nvim-data  (Symlink to folder nvim-data2)
nvim-data1
nvim-data2


############################################################

INSTRUCTIONS

------------------------------------------------------------
Create a symlink:

------------------------------
Windows Command shell
MKLINK

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/mklink

An A-Z Index of Windows CMD commands:
https://ss64.com/nt/mklink.html

MKLINK [[/D] | [/H] | [/J]] LinkName Target
   /D     Create a Directory symbolic link. (default is file)
By default, only Administrators can create symbolic links.

------------------------------
CreateLink
http://multicommander.com/docs/customcommands_list#mc.utils.createlink
MC.Utils.CreateLink
LNKTYPE   1 = Hardlink, 2 = Junction, 3 = Symlink, 4 = Shortcut

------------------------------------------------------------
http://forum.multicommander.com/forum/index.php/topic,1345.msg4769.html#msg4769

To create Symlinks you must be admin.
You can add "ASADMIN" and you will get a UAC dialog, or you can start MC as admin.

LNKTYPE   3 = Symlink
MC.Utils.CreateLink ASADMIN LNKTYPE=3 LNKSRC="<new source folder>" LNKTRG="<existing target folder>"

<new source folder>  Must not exists.
<existing target folder>  It exists.

UAC dialog is shown and MCAdmin (Admin helper Process) is starts
SymLink folder is created and points to existing target folder

------------------------------------------------------------
http://forum.multicommander.com/forum/index.php/topic,2036.msg7804.html#msg7804
Contributor: pncdaspropagandas
Go To Link Target v2

------------------------------------------------------------
Docs:
------------------------------------------------------------

http://multicommander.com/docs/
"Search the Online Documentation" (it is better than pdf)

------------------------------
http://multicommander.com/docs/multiscript/functions/filesystem
http://multicommander.com/docs/multiscript/functions/misc

http://multicommander.com/docs/customcommands_list
http://multicommander.com/docs/customcommands_list#mc.utils.createlink

MultiScript Language Syntax:
http://multicommander.com/docs/multiscript/languagesyntax

------------------------------------------------------------
FileExists
http://multicommander.com/docs/multiscript/functions/filesystem#fileexists
<num> FileExists( <str> path );

Return value: 1 if the path exists and is a file, 2 if the path exists and is a folder,
0 if the path does not exist

Example:
@var $res = FileExists( "C:\\temp\\MyFile.txt" );
@var $symlink_exists = FileExists($source_folder);

------------------------------
DeleteFile
http://multicommander.com/docs/multiscript/functions/filesystem#deletefile

Delete a single file using the Multi Commander virtual filesystem.
<num> DeleteFile( <str> filename, <arr> options );

@var $options[] = {"NOPROGRESS", "NODIALOG", "SILENT", "RECYLE"};
DeleteFile( $filename, $options );

------------------------------
AskText
<num> AskText( <str> label, <str> inputText, <num> option );
http://multicommander.com/docs/multiscript/functions/misc#asktext

@var $answer = AskText("Type 1 for a stable Neovim version, or 2 for test version.", "1", 0);

------------------------------
MessageBox
<num> MessageBox( <str> caption, <str> text, <num> options );
http://multicommander.com/docs/multiscript/functions/misc#messagebox

MessageBox("You have selected a stable Neovim configuration!", "nvim1 - stable", 0);

------------------------------
IF - Condition
http://multicommander.com/docs/multiscript/languagesyntax#if_condition

------------------------------------------------------------
http://multicommander.com/docs/multiscript/functions/string




// "Multi Commander" script:

// MC_Choose_the_Neovim_CONFIG, F12
// Choose the Neovim configuration:  stable config or test config

// ------------------------------------------------------------
// Ask user for Neovim configuration:

@var $answer = AskText("Type 1 for a stable Neovim config, or 2 for test config.", "1", 0);

// If user canceled, abort
if ( $answer == 0 )
{
break;
}

// ------------------------------------------------------------
// Check if the Symlink folder exists:

@var $env = TranslateEnvString("%USERPROFILE%");

@var $source_folder = $env ^ "AppData\\Local\\nvim\\";
@var $source_folder_data = $env ^ "AppData\\Local\\nvim-data\\";

@var $symlink_exists = FileExists($source_folder);

// Return value: 1 if the path exists and is a file, 2 if the path exists and is a folder,
// 0 if the path does not exist

// ------------------------------
// Delete Symlinks:

// @var $options[] = {"NOPROGRESS", "NODIALOG", "SILENT", "RECYLE"};
@var $options[] = {"NOPROGRESS", "NODIALOG", "SILENT"};

if($symlink_exists == 2)
{
DeleteFile( $source_folder, $options );
DeleteFile( $source_folder_data, $options );
}

// ------------------------------------------------------------

@var $target_folder;
@var $target_folder_data;

if($answer == 1)
{
  // stable config

  $target_folder = $env ^ "AppData\\Local\\nvim1\\";
  MC.Utils.CreateLink ASADMIN LNKTYPE=3 LNKSRC={$source_folder} LNKTRG={$target_folder}

  $target_folder_data = $env ^ "AppData\\Local\\nvim-data1\\";
  MC.Utils.CreateLink ASADMIN LNKTYPE=3 LNKSRC={$source_folder_data} LNKTRG={$target_folder_data}

  MessageBox("You have selected a stable Neovim configuration!", "nvim1 - stable", 0);

}
else if($answer == 2)
{
  // test config

  $target_folder = $env ^ "AppData\\Local\\nvim2\\";
  MC.Utils.CreateLink ASADMIN LNKTYPE=3 LNKSRC={$source_folder} LNKTRG={$target_folder}

  $target_folder_data = $env ^ "AppData\\Local\\nvim-data2\\";
  MC.Utils.CreateLink ASADMIN LNKTYPE=3 LNKSRC={$source_folder_data} LNKTRG={$target_folder_data}

  MessageBox("You have selected a test Neovim configuration!", "nvim2 - test", 0);

}
else
{
//

}

#5
Open "File Explorer" (Win-E):
press the Windows logo key + E on your keyboard

C:\UTILS\MultiCommander\MultiCommander.exe
Right Click on file, chose
"Pin to taskbar"

Move icon to first place!

If you want to start "Multi Commander" you need to press:
Win-1 (because it is the first application)
#6
Script / Re: run cmd command in script
March 01, 2022, 15:10:51
Hi,
/Windows has two command-line shells: Windows Command Prompt and PowerShell./

Windows Command Prompt:
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/windows-commands

An A-Z Index of Windows CMD commands:
https://ss64.com/nt/

MKLINK:
https://ss64.com/nt/mklink.html

MKLINK [[/D] | [/H] | [/J]] LinkName Target
/D     Create a Directory symbolic link. (default is file)
By default, only Administrators can create symbolic links.


// ------------------------------------------------------------
// http://forum.multicommander.com/forum/index.php/topic,1345.msg4769.html#msg4769

// To create Symlinks you must be admin.
// You can add "ASADMIN" and you will get a UAC dialog, or you can start MC as admin.

// LNKTYPE 3 = Symlink
// MC.Utils.CreateLink ASADMIN LNKTYPE=3 LNKSRC="<new source folder>" LNKTRG="<existing target folder>"

// <new source folder>  Must not exists.
// <existing target folder>  It exists.

// UAC dialog is shown and MCAdmin (Admin helper Process) is starts
// SymLink folder is created and points to existing target folder

// ------------------------------------------------------------
// http://multicommander.com/docs/customcommands_list#mc.utils.createlink
// MC.Utils.CreateLink
// LNKTYPE 1 = Hardlink, 2 = Junction, 3 = Symlink, 4 = Shortcut

// Windows CMD command:
// MKLINK [[/D] LinkName Target
//    /D     Create a Directory symbolic link. (default is file)

// We're trying this:
// mklink /D "D:\Cloud\Folder" "C:\Labo\MyFolder\"

// ------------------------------------------------------------

@var $source_folder = "D:\\Cloud\\Folder\\";

// @var $env = TranslateEnvString("%USERPROFILE%");
// @var $target_folder = $env ^ "Documents\\MyFolder\\";
@var $target_folder = "C:\\Labo\\MyFolder\\";

// LNKTYPE 3 = Symlink
MC.Utils.CreateLink ASADMIN LNKTYPE=3 LNKSRC={$source_folder} LNKTRG={$target_folder}


#7
Script / Re: Create folder and move selected files
February 28, 2022, 15:43:17
MultiCommander script:
Create folder (your input + current date and time)
and move selected files to that folder (+ docs/multiscript/functions)


// Create_folder_and_move_selected_files_date, F12

// MultiCommander script:
// Create folder (your input + current date and time)
// and move selected files to that folder (+ docs/multiscript/functions)

// http://forum.multicommander.com/forum/index.php/topic,2079.0.html
// Contributor: pncdaspropagandas

// #########################################################

// ### Docs ###
// Inserted, 2022-02M-20 16:20:25

// User Defined Commands - MultiScript:
// http://multicommander.com/docs/UDC_multiscript

// MultiScript Language Syntax:
// http://multicommander.com/docs/multiscript/languagesyntax

// ---------------------------------------------------------
// http://multicommander.com/docs/multiscript/functions/misc

// AskText
// <num> AskText( <str> label, <str> inputText, <num> option );
// http://multicommander.com/docs/multiscript/functions/misc#asktext

// MessageBox
// <num> MessageBox( <str> caption, <str> text, <num> options );
// http://multicommander.com/docs/multiscript/functions/misc#messagebox

// Log - Log text to a log window.
// <num> Log( <num> logID, <num> logLevel, <str> logText );
// http://multicommander.com/docs/multiscript/functions/misc#log

// ---------------------------------------------------------
// http://multicommander.com/docs/multiscript/functions/filesystem

// FileExists
// @var $res = FileExists( "C:\\temp\\MyFile.txt" );
// http://multicommander.com/docs/multiscript/functions/filesystem#fileexists

// IsFolder
// @var $res = IsFolder( "C:\\temp" );
// http://multicommander.com/docs/multiscript/functions/filesystem#isfolder

// MakeDir
// MakeDir( "C:\\Temp\NewFolder\\SubFolder\\", "LOCAL,RECURSIVE" );
// MakeDir( "C:\\Temp\\MyFiles.zip\\Folder", "" );
// http://multicommander.com/docs/multiscript/functions/filesystem#makedir

// MoveFile
// MoveFile( $targetPath, $sourceFile, "NODIALOG, OVERWRITE_ALL" );
// http://multicommander.com/docs/multiscript/functions/filesystem#movefile

// ---------------------------------------------------------
// http://multicommander.com/docs/multiscript/functions/string

// StrSub
// <str> StrSub(<str> input, <num> offset, <num> length);
// http://multicommander.com/docs/multiscript/functions/string#strsub

// StrIsEqual
// <num> StrIsEqual(<str> string1, <str> string2);
// http://multicommander.com/docs/multiscript/functions/string#strisequal

// StrLen
// @var $len = StrLen( $str );
// http://multicommander.com/docs/multiscript/functions/string#StrLen

// ---------------------------------------------------------
// MultiScript - Get and Set Selection and Paths
// http://multicommander.com/docs/multiscript/functions/getfilefromview

// GetSourceSelectedPaths
// @var $arr = GetSourceSelectedPaths("IGNORE_FOCUS");
// Get an array with the full paths of all selected items in the source view.
// http://multicommander.com/docs/multiscript/functions/getfilefromview#getsourceselectedpaths

// ---------------------------------------------------------
// MultiScript - Array functions
// http://multicommander.com/docs/multiscript/functions/array


// #########################################################

@var $now = GetTime();
@var $date = FormatDate( "yyyy-MMm-dd" , $now );
@var $time = FormatTime( "HH-mm" , $now );

// Ask user for folder name
@var $answer = AskText("Type name of the new folder to create and move selected files.", "New folder", 0);

// If user canceled, abort
if ( $answer == 0 )
{
break;
}

// $folder = $source_path ^ ($answer + "_" + $date + "_" + $time);
$answer = $answer + "_" + $date + "_" + $time;

// ---------------------------------------------------------

// Folder exists?
@var $source_path = GetSourcePath();
if( FileExists($source_path ^ $answer) > 0 )
{
MessageBox("Error", "Typed folder already exists.", 0);
break;
}
else
{
// Create empty folder
// Check if source path is LOCAL
@var $options;
if( IsFolder($source_path) )
{
@var $colon_check = StrSub($source_path, 1, 1);
if( StrIsEqual($colon_check, ":") )
{
$options = "LOCAL,RECURSIVE";
}
else
{
$options = "";
}
}
else
{
$options = "";
}

if( MakeDir($source_path ^ $answer, $options) == 0 )
{
Log( 1, 10, "Created : " + $source_path ^$answer );
@var $selected_files = GetSourceSelectedPaths();
@var $n;
@var $len = StrLen($answer) - 1;
@var $slash = StrSub($answer, $len, 1);
if( StrIsEqual($slash, "\\") )
{
$slash = "";
}
else
{
$slash = "\\";
}
for( $n=0; $n<arrayCount($selected_files); $n++ )
{
// MoveFile has a bug where target path has to end with slash
if( $n == 0 )
{
MoveFile($source_path ^ $answer + $slash, $selected_files[$n], "NODIALOG,NOWAIT,USEEXISTINGQUEUE");
}
else
{
MoveFile($source_path ^ $answer + $slash, $selected_files[$n], "NODIALOG,NOWAIT,USEEXISTINGQUEUE");
}
}

// Select created folder
// SetClipboardText($source_path ^ $answer);
// MC.RunCmd ID="Core.1312"
// MC.Explorer.Selection.UnselectAll
}
else
{
MessageBox("Error", "Error while creating folder.", 0);
break;
}
}

#8
Script / Re: run cmd command in script
February 20, 2022, 19:53:43
I'm sorry,

I deleted the web links...
maybe I'll write something later.
#9
also tested    ;)
(Format Date and Time + Ask user for folder name)



// MC_Create_folder_your_input_and_date_format, F12

// MultiCommander script: Create a new folder (your input, current date and time, format)
// 2022-02M-20 18:55:27

// ---------------------------------------------------------
@var $now = GetTime();

@var $folder;
@var $FolderBaseName = GetSourcePath();

// ---------------------------------------------------------
// @var $date = FormatDate( "yyyy-MM-dd" , $now );

@var $year = FormatDate( "yyyy" , $now );
@var $month = FormatDate( "MM" , $now );
@var $day = FormatDate( "dd" , $now );

@var $date = $year + "-" + $month + "M-" + $day;

// ---------------------------------------------------------
// @var $time = FormatTime( "HH-mm" , $now );

@var $hours = FormatTime( "HH" , $now );
@var $minutes = FormatTime( "mm" , $now );

@var $time = $hours + "h-" + $minutes;

// ---------------------------------------------------------

// Ask user for folder name
@var $answer = AskText("Type name of the new folder to create and move selected files.", "backup", 0);

// If user canceled, abort
if ( $answer == 0 )
{
break;
}

$folder = $FolderBaseName ^ ($answer + "_" + $date + "_" + $time);

MC.Filesystem.Makedir PATH={$folder}

// ---------------------------------------------------------


#10
tested (+ Ask user for folder name)  :)


// MC_Create_folder_your_input_and_date, F12

// MultiCommander script:
// Create a new folder (your input, current date and time)
// 2022-02M-20 18:07:48

// ---------------------------------------------------------
// http://forum.multicommander.com/forum/index.php/topic,1184.msg4072.html#msg4072
// Multi Commander Support Forum »Multi Commander »Script »create a new open folder with the current date
// Contributor: Ulfhednar

// Decided to try making a script for this.
// config/user defined commands -> new - insert name & decription;
// command type dropdown select - multiscript -

// See also
// http://forum.multicommander.com/forum/index.php/topic,1197.msg4124.html#msg4124

// ---------------------------------------------------------
// http://multicommander.com/docs/multiscript/functions/datetime

// http://forum.multicommander.com/forum/index.php/topic,4094.0.html

// ---------------------------------------------------------
@var $now = GetTime();
@var $date = FormatDate( "yyyy-MMm-dd" , $now );
@var $time = FormatTime( "HH-mm" , $now );

@var $folder;
@var $FolderBaseName = GetSourcePath();

// ---------------------------------------------------------
// Ask user for folder name
@var $answer = AskText("Type name of the new folder to create.", "backup", 0);

// If user canceled, abort
if ( $answer == 0 )
{
break;
}

$folder = $FolderBaseName ^ ($answer + "_" + $date + "_" + $time);

MC.Filesystem.Makedir PATH={$folder}

// ---------------------------------------------------------

#11
Script / Re: Create folder and move selected files
February 19, 2022, 18:58:25
tested and documented:
:)


// Create_folder_and_move_selected_files, F12

// http://forum.multicommander.com/forum/index.php/topic,2079.0.html
// Create folder and move selected files to that folder
// Contributor: pncdaspropagandas

// #########################################################

// ### Docs ###
// Inserted, 2022-02M-20 16:20:25

// User Defined Commands - MultiScript:
// http://multicommander.com/docs/UDC_multiscript

// MultiScript Language Syntax:
// http://multicommander.com/docs/multiscript/languagesyntax

// ---------------------------------------------------------
// http://multicommander.com/docs/multiscript/functions/misc

// AskText
// <num> AskText( <str> label, <str> inputText, <num> option );
// http://multicommander.com/docs/multiscript/functions/misc#asktext

// MessageBox
// <num> MessageBox( <str> caption, <str> text, <num> options );
// http://multicommander.com/docs/multiscript/functions/misc#messagebox

// Log - Log text to a log window.
// <num> Log( <num> logID, <num> logLevel, <str> logText );
// http://multicommander.com/docs/multiscript/functions/misc#log

// ---------------------------------------------------------
// http://multicommander.com/docs/multiscript/functions/filesystem

// FileExists
// @var $res = FileExists( "C:\\temp\\MyFile.txt" );
// http://multicommander.com/docs/multiscript/functions/filesystem#fileexists

// IsFolder
// @var $res = IsFolder( "C:\\temp" );
// http://multicommander.com/docs/multiscript/functions/filesystem#isfolder

// MakeDir
// MakeDir( "C:\\Temp\NewFolder\\SubFolder\\", "LOCAL,RECURSIVE" );
// MakeDir( "C:\\Temp\\MyFiles.zip\\Folder", "" );
// http://multicommander.com/docs/multiscript/functions/filesystem#makedir

// MoveFile
// MoveFile( $targetPath, $sourceFile, "NODIALOG, OVERWRITE_ALL" );
// http://multicommander.com/docs/multiscript/functions/filesystem#movefile

// ---------------------------------------------------------
// http://multicommander.com/docs/multiscript/functions/string

// StrSub
// <str> StrSub(<str> input, <num> offset, <num> length);
// http://multicommander.com/docs/multiscript/functions/string#strsub

// StrIsEqual
// <num> StrIsEqual(<str> string1, <str> string2);
// http://multicommander.com/docs/multiscript/functions/string#strisequal

// StrLen
// @var $len = StrLen( $str );
// http://multicommander.com/docs/multiscript/functions/string#StrLen

// ---------------------------------------------------------
// MultiScript - Get and Set Selection and Paths
// http://multicommander.com/docs/multiscript/functions/getfilefromview

// GetSourceSelectedPaths
// @var $arr = GetSourceSelectedPaths("IGNORE_FOCUS");
// Get an array with the full paths of all selected items in the source view.
// http://multicommander.com/docs/multiscript/functions/getfilefromview#getsourceselectedpaths

// ---------------------------------------------------------
// MultiScript - Array functions
// http://multicommander.com/docs/multiscript/functions/array


// #########################################################

// Ask user for folder name
@var $answer = AskText("Type name of the new folder to create and move selected files.", "New folder", 0);

// If user canceled, abort
if ( $answer == 0 )
{
break;
}

// Folder exists?
@var $source_path = GetSourcePath();
if( FileExists($source_path ^ $answer) > 0 )
{
MessageBox("Error", "Typed folder already exists.", 0);
break;
}
else
{
// Create empty folder
// Check if source path is LOCAL
@var $options;
if( IsFolder($source_path) )
{
@var $colon_check = StrSub($source_path, 1, 1);
if( StrIsEqual($colon_check, ":") )
{
$options = "LOCAL,RECURSIVE";
}
else
{
$options = "";
}
}
else
{
$options = "";
}

if( MakeDir($source_path ^ $answer, $options) == 0 )
{
Log( 1, 10, "Created : " + $source_path ^$answer );
@var $selected_files = GetSourceSelectedPaths();
@var $n;
@var $len = StrLen($answer) - 1;
@var $slash = StrSub($answer, $len, 1);
if( StrIsEqual($slash, "\\") )
{
$slash = "";
}
else
{
$slash = "\\";
}
for( $n=0; $n<arrayCount($selected_files); $n++ )
{
// MoveFile has a bug where target path has to end with slash
if( $n == 0 )
{
MoveFile($source_path ^ $answer + $slash, $selected_files[$n], "NODIALOG,NOWAIT,USEEXISTINGQUEUE");
}
else
{
MoveFile($source_path ^ $answer + $slash, $selected_files[$n], "NODIALOG,NOWAIT,USEEXISTINGQUEUE");
}
}

// Select created folder
// SetClipboardText($source_path ^ $answer);
// MC.RunCmd ID="Core.1312"
// MC.Explorer.Selection.UnselectAll
}
else
{
MessageBox("Error", "Error while creating folder.", 0);
break;
}
}

#12
Support and Feedback / docs/customcommands_examples
February 19, 2022, 18:49:57
Hi.
I think the file name cannot have ":" .
No:  -${time:hh:mm:ss}.zip"

Custom Commands - Examples
http://multicommander.com/docs/customcommands_examples

Pack Files

Not ( "file:name".txt):
MC.Filesystem.PackFiles FILES="D:\MyFiles\*.*" METHOD="Zip" TARGET="${targetpath}${date:yyyy-MM-dd}-${time:hh:mm:ss}.zip"

That ("file-name".txt):
MC.Filesystem.PackFiles FILES="D:\MyFiles\*.*" METHOD="Zip" TARGET="${targetpath}${date:yyyy-MM-dd}_${time:HH-mm-ss}.zip"