Multi Commander > Script
Debugger in 4.3 hangs MC on error
Ulfhednar:
I found a way of doing it :)
--- Code: ---@var $now = GetTime();
@var $date = FormatDate( "dd-MM-yyyy" , $now );
@var $time = FormatTime( "HHmm", $now);
@var $folder;
@var $FolderBaseName = GetTargetPath();
@var $path = GetSourceFocusName();
@var $name = PathGetNamePart( $path , 1 );
$folder = $FolderBaseName ^ $name + " " + $date + " " +$time +"Hrs";
MC.Filesystem.Makedir PATH="{$folder}"
MC.SetActivePanel PANEL TOGGLE
MC.Explorer.Goto TARGET="{$folder}"
--- End code ---
Mathias (Author):
--- Quote from: Ulfhednar on June 01, 2014, 20:38:22 ---
--- Code: ---MC.SetActivePanel PANEL TOGGLE
--- End code ---
--- End quote ---
Wrong you missing the =
MC.SetActivePanel PANEL=TOGGLE
But Goto with TARGET as you wrote above should also work
Just make sure there is no extra space between the OPTION name and the Parameter.
MC.Explorer.Goto TARGET="{$folder}"
Ulfhednar:
I see. That explains why I found some problems. :)
My final script for today:-
* Select a file;
* Create folder in inactive pane, named for selected file & appending date & time;
* Open the new folder in the inactive pane & move the file selected in the active pane, into the new folder in the inactive pane.
--- Code: ---@var $now = GetTime();
@var $date = FormatDate( "dd-MM-yyyy" , $now );
@var $time = FormatTime( "HHmm", $now);
@var $folder;
@var $FolderBaseName = GetTargetPath();
@var $path = GetSourceFocusName();
@var $name = PathGetNamePart( $path , 1 );
$folder = $FolderBaseName ^ $name + " " + $date + " " +$time +"Hrs";
MC.Filesystem.Makedir PATH="{$folder}"
MC.Explorer.Goto TARGET="{$folder}"
MC.SetActivePanel PANEL=TOGGLE
MC.Explorer.Select ONLYFILES="$path"
MC.Explorer.Move NODIALOG USEEXISTINGQUEUE
--- End code ---
Baby steps I guess, but potentially useful ;)
Mathias (Author):
If you just want to move the selected files into a date folder on the target path.
Then here is an alternative solution.
The target folder do not need to create first. By using MoveFile(...) you can set target path and if target folder does not exists it will be created.
--- Code: ---@var $now = GetTime();
@var $date = FormatDate( "dd-MM-yyyy" , $now );
@var $time = FormatTime( "HHmm", $now);
@var $targetFolder;
@var $FolderBaseName = GetTargetPath();
// Get full path to file in focus
@var $path = GetSourceFocusPath();
@var $name = PathGetNamePart( $path , 1 );
// Build target path. and make sure that it ends with a slash so it knows that it is a folder.
$targetFolder = $FolderBaseName ^ $name + " " + $date + " " + $time +"Hrs" + "\\";
MoveFile( $targetFolder, $path , "NODIALOG, USEEXISTINGQUEUE, NOWAIT");
--- End code ---
Ulfhednar:
That is an interesting script, & will give me ideas! :)
I can see I have a way to go to get near your understanding of this.
I have not noticed NOWAIT before.
I notice some cool new new folder F-key options in 4.3 b1694. I will find these helpful.
Do these new functions have commands in the scripting (MS & MC.<command>) forms also?
Tho that may not be necessary given the script provided here.
Thank you for the assistance & the continued development of MC, don't know what I would do without it now. ;)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version