Multi Commander > Script
Rename & move/copy
Mathias (Author):
You can call a command, internal or user created.
MC.RunCmd ID=<cmd id>
Ulfhednar:
OK thanks Mathias, that will be something I can play with. :)
I am finding using findfiles for files inside a selected folder difficult. I can't figure out how to make it search & select inside the selected folder. That said, it is easier to use the built in search function in this case. Copying features you already have might be counter-productive to learning something... :-\
In which case the following is probably irrelevant.
I'm not sure about my syntax - (<arr>,"xxxxx")
Just trying to get the debugger to return the txt match in the folder at this point. It shows the folder name not the txt inside the selected folder.
But perhaps this not within the scope of the find command?
This is what I have so far: -
--- Code: ---@var $arr = GetSourceSelectedPaths();
@var $items = arrayCount($arr);
@var $CurrentNameFullPath;
@var $file
@var $files;
@var $files1;
@var $n = 0;
//find txt
for( $n = 0; $n < $items; $n++ )
{
$file = $arr[ $n ];
$files = PathGetFileExtPart( $file );
$files1 = FindFiles( $files, "*.txt");
}
--- End code ---
The upside is I now have several small routines to automate some of my regular tasks.
Been very interesting so far. :)
Mathias (Author):
--- Quote from: Ulfhednar on August 25, 2013, 18:06:28 ---I am finding using findfiles for files inside a selected folder difficult. I can't figure out how to make it search & select inside the selected folder. That said, it
--- End quote ---
Not sure what you mean with select. I think that you might try to use script for controlling the UI?
The script engine is separate. It is not connected to the UI. It can fetch some information from UI, But that all.
Think more of it like .bat files in windows command line.
FindFiles will return an array with path to files it finds when scanning that path you tell it to scan.
$files = PathGetFileExtPart( $file );
Get get the file extension part here Like ".txt" and use that as a path into FindFiles.
You need to send a path WITH filter like "C:\Temp\*.txt" into FindFiles
If you look at the doc you see that the second parameter is if <num> (number) and if it is 1 then it will only match files,
$files = FindFiles( "C:\\Temp\\*.txt" );
Ulfhednar:
Thanks for looking at this Mathias.
I had looked at the docs then at Jungles script (Name as Folder)
--- Code: --- $file = $arr[$i];
$s = PathGetFileExtPart( $file );
$name = $prefix + "*" + $s;
$files = FindFiles( $src_path + $name );
$n = arrayCount( $files );
--- End code ---
& thought that I could also give a string variable. I looked at my code today & realized I'd omitted that bit! (& probably other things...)
I think you're right about the UI.
My idea will be best handled by MCs own tools, so I will need to study the MC.<command> features more closely. That could give me some great automation.
e.g. I like the ability to load the explorer panel filter via a button - "MC.Explorer.SetViewFilter" - is very useful.
So I need to play with the other commands.
I think that the ideas I had clash between using MC script & taking over parts of the MC UI environment.
I am not 100% sure of boundaries yet.
I can see DOS .bat type script is cumbersome/weak compared to the MC script, & that the script is out classed by C++ MFC.
Now I'm learning more about using the right tool for my job.
I think a button script calling MC commands could allow me to -
activate in-line edit
paste in clipboard contents
copy/move
Which might make a useful button.
Using my new MCscript based buttons has improved my work environment a great deal.
I noticed on the 1481 update today that array processing by functions has changed. If I understand this correctly it looks like scripting will be quicker & easier. This will help me move forward in my experiments.
OT - I found a handy free regex tester that anyone wanting to use the MCS regex functions might find useful - http://antix.co.uk/Projects/Regex-Tester The variables it shows seem fully compatible but I haven't tried them all yet!
Mathias (Author):
--- Quote from: Ulfhednar on August 26, 2013, 14:46:59 ---I think you're right about the UI.
My idea will be best handled by MCs own tools, so I will need to study the MC.<command> features more closely. That could give me some great automation.
e.g. I like the ability to load the explorer panel filter via a button - "MC.Explorer.SetViewFilter" - is very useful.
So I need to play with the other commands.
I think that the ideas I had clash between using MC script & taking over parts of the MC UI environment.
I am not 100% sure of boundaries yet.
--- End quote ---
Using the "CustomCommands" you can set some part of the UI. Even if you used them in MultiScript.
But if you go crazy I think you can break things..
hehe If you learn C++ program you can create plugins instead. From there you have a lot more control
--- Quote from: Ulfhednar on August 26, 2013, 14:46:59 ---I can see DOS .bat type script is cumbersome/weak compared to the MC script, & that the script is out classed by C++ MFC.
--- End quote ---
I was more thinking that you can write stuff in .bat script but you do not change the UI of Window Explorer or other programs from .bat script
They work against the same filesystem but there are separate layers of viewing it.
--- Quote from: Ulfhednar on August 26, 2013, 14:46:59 ---I noticed on the 1481 update today that array processing by functions has changed. If I understand this correctly it looks like scripting will be quicker & easier.
--- End quote ---
That was only a bug fix when inilizing array using single quote characters instead of double.
instead of
@var $arr[] = { "string1" , "string2" }
one can write
@var $arr[] = { 'string1' , 'string2' } <<= did not work before, works is 1481+
Why single quote? if you need to have " inside the string.
Instead of writing @var $text = "\"1\" is good" you can write @var $text = 'string "1" is good'
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version