Hi I'd like to learn how to Replace the variable length of my Title tags
From this:
Mozart P Con #6 In B Flat, K 238 - 3. Rondeau
Mozart P Con #7 In F For 2/3 Pianos, K 242, "Lodron" - 1. Allegro
Mozart P Con #7 In F For 2/3 Pianos, K 242, "Lodron" - 2. Adagio
Mozart P Con #7 In F For 2/3 Pianos, K 242, "Lodron" - 3. Rondeau
Mozart P Con #8 In C, K 246, "Lützow" - 1. Allegro Aperto
To This:
Mozart P Con #6 - 3
Mozart P Con #7 - 1
Mozart P Con #7 - 2
Mozart P Con #7 - 3
Mozart P Con #8 - 1
I imagine this is an action but if it is multiple Tag-tag that would be great - maybe even more clear? Thanks
Using an action like below will do your task by using tag-tag either.
Begin Action Group _Script Test#TEST
Action #1Actiontype 5: Format valueField ______: TITLEFormatstring: $regexp(%title%,'^(.{13,15}#\d+\s+)[^-]+(-\s+\d+).+','$1$2')
End Action Group _Script Test#TEST (1 Action)
Of example file Mozart P Con #6 In B Flat, K 238 - 3. Rondeau the only variable is between the #6 and 3 and at the end where there is the same problem. This is dealt with [^-]+ which finds anything but a - any number of times after #6 and .+ which takes care of that problem at the end after 3.
Please have a look at the screen-shot of how the regexp works.
I wouldn't expect this character count to work well, except in the very narrow context of the example strings. It shouldn't be necessary if you always have '#\d+', or even just '\d+'.
Your example strings have varying length and look like as they are following always the same pattern.
%TMP1% #%TMP2% %DUMMY% - %TMP3%. %DUMMY%
There are fix points in each string, so you can use an action "Guess values" to split the original title string into parts and save the valueable parts into temporary tag-fields.
Then assemble the new title string from the temporary tag-fields and put it in a temporary tag-field too.
If the results are looking good, then overwrite the tag-field TITLE with the newly calculated title value.
Afterwards remove the temporary helper tag-fields.
Here is an action group which has all steps included.