Multi Commander > Script

Rename profiles accessed by MS?

(1/2) > >>

Ulfhednar:
I see that it is possible to use filters in MS now & maybe dreamed this also applied to rename profiles..?
So far I cannot find anything related to MS calling rename filters though.
Perhaps it is a 'to do'?
If not please point me in the right direction! ;)

Meanwhile I will have to do it the old way,   ;D

Merry Xmas

Ulfhednar:
Thought I'd share my 'solution'.  I expect the MS wizards will know a better/optimal way, but this works for me on one or multiple files to clean up/replace  unwanted chars in filenames. ;)


--- Code: ---//Name cleanup

@var $arr1 = GetSourceSelectedPaths();
@var $items = arrayCount($arr1);
@var $CurrentNameFullPath;
@var $OrgName;
@var $NewName0;
@var $NewName1;
@var $NewName2;
@var $NewName3;
@var $NewName4;
@var $NewName5;
@var $n1;

for( $n1 = 0; $n1 < $items; $n1++ )
{
  $CurrentNameFullPath = $arr1[ $n1 ];
  $OrgName = PathGetNamePart( $CurrentNameFullPath );
  $NewName0 = StrReplace( $OrgName, "_ " , "-" );
  $NewName1 = StrReplace( $NewName0, " m" , " e " );
  $NewName2 = StrReplace( $NewName1, " r" , "R" );
  $NewName3 = StrReplace( $NewName2, " y" , " " );
  $NewName4 = StrReplace( $NewName3, " x" , "m" );
  $NewName5 = StrReplace( $NewName4, "a" , " s" );
 
  RenameFile( $CurrentNameFullPath, $NewName5, "SILENT" );
}


--- End code ---

Mathias (Author):

--- Quote from: Ulfhednar on December 24, 2016, 16:27:43 ---I see that it is possible to use filters in MS now & maybe dreamed this also applied to rename profiles..?
So far I cannot find anything related to MS calling rename filters though.
Perhaps it is a 'to do'?
If not please point me in the right direction! ;)

Meanwhile I will have to do it the old way,   ;D

Merry Xmas

--- End quote ---
Filters is not new in the release ?
Not sure I get what you want to do ?

Mathias (Author):

--- Quote from: Ulfhednar on December 25, 2016, 11:08:19 ---Thought I'd share my 'solution'.  I expect the MS wizards will know a better/optimal way, but this works for me on one or multiple files to clean up/replace  unwanted chars in filenames. ;)


--- Code: ---//Name cleanup

@var $arr1 = GetSourceSelectedPaths();
@var $items = arrayCount($arr1);
@var $CurrentNameFullPath;
@var $OrgName;
@var $NewName0;
@var $NewName1;
@var $NewName2;
@var $NewName3;
@var $NewName4;
@var $NewName5;
@var $n1;

for( $n1 = 0; $n1 < $items; $n1++ )
{
  $CurrentNameFullPath = $arr1[ $n1 ];
  $OrgName = PathGetNamePart( $CurrentNameFullPath );
  $NewName0 = StrReplace( $OrgName, "_ " , "-" );
  $NewName1 = StrReplace( $NewName0, " m" , " e " );
  $NewName2 = StrReplace( $NewName1, " r" , "R" );
  $NewName3 = StrReplace( $NewName2, " y" , " " );
  $NewName4 = StrReplace( $NewName3, " x" , "m" );
  $NewName5 = StrReplace( $NewName4, "a" , " s" );
 
  RenameFile( $CurrentNameFullPath, $NewName5, "SILENT" );
}


--- End code ---

--- End quote ---
(Why do use NewName1 -> 5, ?? why not use the same variable ?? )

In the MultiRename tool you can replace char x with y and so on in the search and replace part

Ulfhednar:
Sorry to ruin your Xmas break Mathias!  :o

Originally I wanted to call an existing rename profile (in the same way as a filter) with a MScript.  Couldn't see how to do that.  Filters have an ID to call but I have not found ID tags in the rename dialog & didn't dig deeper. 

Not all files contain all the same items I want to change.  Some have one character to change, others some or all.
I wasn't sure I could apply a single @var to this task.  I expected conflicts.
I concluded that with multiple possible case-sensitive rename actions, I needed to queue them discretely, so gave them different @vars.   
Would a Function concatenate multiple changes...?

As you know I like to cause headaches with MultiScript - I find it therapeutic.   8) :)

Navigation

[0] Message Index

[#] Next page

Go to full version