Page 1 of 1

[Scripting Help]Set specific comments to selected files

Posted: 01 Jul 2016 06:59
by xnmp
I Have those files ,for example (the filename does not matter)

Code: Select all

fileA
fileb
filec
... and fileD, FileE so on
i want to set comment a001,a002, a003 .... to them , (due to the current sort order)

Code: Select all

fileA : set comment a001
fileb : set comment a002
filec : set comment a003
... and so on
Is it possible to do it by xyplorer script ? like this : Select multiple files, run the script and the comment will be set
Any help would be much appreciated

Re: [Scripting Help]Set specific comments to selected files

Posted: 04 Jul 2016 09:38
by LittleBiG

Code: Select all

//set comments
  $prefix = "a";  //the first, text part of the comment
  $num_len = 3;   //the length of the number part
  $count = 1;     //the start of numbering
  foreach($item, get("SelectedItemsPathNames","|")) { 
    tag $prefix . strrepeat("0", $num_len - strlen($count)) . $count++, $item, 2, 1;
  }
Edit: comments added. Change those parameters to modify the behaviour of the script.

Re: [Scripting Help]Set specific comments to selected files

Posted: 05 Jul 2016 08:28
by xnmp
LittleBiG wrote:

Code: Select all

//set comments
  $prefix = "a";  //the first, text part of the comment
  $num_len = 3;   //the length of the number part
  $count = 1;     //the start of numbering
  foreach($item, get("SelectedItemsPathNames","|")) { 
    tag $prefix . strrepeat("0", $num_len - strlen($count)) . $count++, $item, 2, 1;
  }
Edit: comments added. Change those parameters to modify the behaviour of the script.
Works like a charm, :P
Thank you very much, LittleBiG ,i really appreciate your effort
:mrgreen: