[Scripting Help]Set specific comments to selected files

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
xnmp
Posts: 88
Joined: 15 Mar 2013 04:46

[Scripting Help]Set specific comments to selected files

Post 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

LittleBiG
Posts: 1848
Joined: 08 Apr 2011 12:57
Location: Win10x64

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

Post 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.

xnmp
Posts: 88
Joined: 15 Mar 2013 04:46

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

Post 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:

Post Reply