#1 : 10/07-17 19:07 alain
Posts: 3
|
Hello,
I would like to get this : "Chicago - 25 or 6 to 4..mp3" with this "25 or 6 to 4 (Chicago).mp3" : is it possible ? Tks |
#2 : 10/07-17 21:17 Rick
Posts: 7
|
Reply to #1:
Create a following script method (not tested, so I may have made a typo) by cutting and pasting the following into a script text box. var name = item.filename; var song = /.*\(/.exec(name); // get everything up to the first parentheses song = song.replace(/\(/,""); // strip off the trailing left parentheses var band = /\(.*\)/.exec(name); // get what's between the parentheses band = band.replace(/[\(\)]/g,""); // strip the parentheses return band + " - " + song; |
#3 : 11/07-17 18:21 alain
Posts: 3
|
Reply to #2:
thanks. Error line 5 : "song.replace" is not a function |
#4 : 11/07-17 22:43 Rick
Posts: 7
|
Reply to #3:
Fixed and tested. Should work now. I found a couple of other issues besides not knowing that I had to explicitly cast the variables to strings. var name = item.newName; var song = /.*\(/.exec(name); // get everything up to the first parentheses song = "" + song; // force song into a string (surprised this was needed) song = song.replace(/\(/,""); // strip off the trailing left parentheses song = song.trim(); // get that trailing space var band = /\(.*\)/.exec(name); // get what's between the parentheses band = "" + band; // let's make a string band = band.replace(/[\(\)]/g,""); // strip the parentheses return band + " - " + song; |
#5 : 12/07-17 08:15 alain
Posts: 3
|
Reply to #4:
Tks, it's great ! Have a good day. |
#6 : 15/07-17 02:56 D.Ach
Posts: 35
|
Reply to #1
Here is a simple Add Method way: "Chicago - 25 or 6 to 4.mp3" In the program settings, set word separator as space. Clear everything out and just input a space " " (no quotes). ADD: "(<Word:1>)" At Index: "1" Backwards: check REPLACE: "<Word:1> <Word:2> " Replace With: "empty" Result: "25 or 6 to 4 (Chicago).mp3" |