Special characters in replacement matrix

Main discussion forum
Post Reply
Wronschien
Newbie
Newbie
Posts: 9
Joined: Thu Jul 31, 2014 10:05 pm
Location: Montauban, France

Special characters in replacement matrix

Post by Wronschien »

Hello, I've been using TGF for a few years now, and I'm a bit struggling with the new formatting options.
Specifically I've got a problem with the replacement matrix. When I set a character (or word) to match and replace, it generally works, except for the two ones I'd really like to replace !
That is ':' and '/'. The new version just doesn't find them although they really occur in the tag fields.
This used to work like a charm in the previous version (0.72 I think, it was on my older PC).
Is there a new mechanism I haven't understood ?

User avatar
jtclipper
Administrator
Administrator
Posts: 768
Joined: Tue Aug 10, 2010 12:04 pm

Re: Special characters in replacement matrix

Post by jtclipper »

Please make sure that in your workflow you have a task with a matrix,
in the lower part of the screen select your created matrix in the 'task parameters' and in the 'apply to' list check the fields you want to format.

Wronschien
Newbie
Newbie
Posts: 9
Joined: Thu Jul 31, 2014 10:05 pm
Location: Montauban, France

Re: Special characters in replacement matrix

Post by Wronschien »

Well that's what I'm doing and this works for any word I've tried… but not for these two characters !
Thanks for the reply though

User avatar
jtclipper
Administrator
Administrator
Posts: 768
Joined: Tue Aug 10, 2010 12:04 pm

Re: Special characters in replacement matrix

Post by jtclipper »

Can you send me your tgf.ini file so I can reproduce if possible?
Also what Windows version are you using

Wronschien
Newbie
Newbie
Posts: 9
Joined: Thu Jul 31, 2014 10:05 pm
Location: Montauban, France

Re: Special characters in replacement matrix

Post by Wronschien »

Alright, here it is.
I'm running Windows 7 64bit.

(And btw, it really hates when I hit the "Alt Gr" key, an error window pops "Access violation as address 00000000. Read of address 00000000." But this is not that much trouble)
Attachments
tgf.7z
(3.88 KiB) Downloaded 229 times

User avatar
jtclipper
Administrator
Administrator
Posts: 768
Joined: Tue Aug 10, 2010 12:04 pm

Re: Special characters in replacement matrix

Post by jtclipper »

In your workflow you need to select the fields you would like to update, only filename is selected in the matrix task (the default), check all the tag fields that you are using

Wronschien
Newbie
Newbie
Posts: 9
Joined: Thu Jul 31, 2014 10:05 pm
Location: Montauban, France

Re: Special characters in replacement matrix

Post by Wronschien »

I did that, actually the filename is the only one to be changed in that case (and that's precisely because / and : are not allowed in filenames that I want them replaced).
But the settings are right anyway, because if I change the character '/' in the matrix to any word (that appears in the files of course) and make no other change then the filename is modified accordingly.

hopalongrock
Sr. Member
Sr. Member
Posts: 289
Joined: Wed Sep 15, 2010 1:38 pm

Re: Special characters in replacement matrix

Post by hopalongrock »

Maybe the Options - Edit - Rename - Illegal characters - Remove/Replace action happens before the Workflow & Replacement matrix action on filename. It isn't possible to disable the illegal character rename.

Wronschien
Newbie
Newbie
Posts: 9
Joined: Thu Jul 31, 2014 10:05 pm
Location: Montauban, France

Re: Special characters in replacement matrix

Post by Wronschien »

hopalongrock wrote:Maybe the Options - Edit - Rename - Illegal characters - Remove/Replace action happens before the Workflow & Replacement matrix action on filename. It isn't possible to disable the illegal character rename.
Exactly ! Now it works indeed, thank you for this answer.
It would be better if we could disable this behaviour or set specific replacements for individual illegal characters but still. Maybe have the possibility to apply the matrix before the automatic removal?
At least I understand what's happening and this can be worked around now.

User avatar
jtclipper
Administrator
Administrator
Posts: 768
Joined: Tue Aug 10, 2010 12:04 pm

Re: Special characters in replacement matrix

Post by jtclipper »

In that case you can use variable scripts to override the illegal character replacement.

You need to go to options/formatting/variables and in the user tab click 'manage..' in the script section and paste this code

Code: Select all

begin
  var_result( AnsiReplaceText( gTag.Artist, ':', ' --' ) );
end.
Save the file (for example) as art.scv

Now in the filename format string I see you use something like %A% - %Y% - %L% - %R% - %T% replace with %@art.scv% - %Y% - %L% - %R% - %T%, as you can see the artist variable is now using the script above.

So when the filename is constructed it will receive a formatted string that replaces ':' with ' --' as you have set in your matrix.
You must alter the default matrix though because it replaces '--' with ''

Following the above example you can do the same with %L% and %T%.

Now you only need to take care of the '/' character so in the illegal rename character option set 'replace with..' to '-'

Wronschien
Newbie
Newbie
Posts: 9
Joined: Thu Jul 31, 2014 10:05 pm
Location: Montauban, France

Re: Special characters in replacement matrix

Post by Wronschien »

Ah yes this is a good idea thank you !

And many thanks for this very nice piece of software of course.

User avatar
jtclipper
Administrator
Administrator
Posts: 768
Joined: Tue Aug 10, 2010 12:04 pm

Re: Special characters in replacement matrix

Post by jtclipper »

I had a look at the new code and there is actually a glitch with illegal chars and the workflow.
Your original matrix should work in the first place, will try and sort this out in the next beta to make the behavior more straightforward.

Wronschien
Newbie
Newbie
Posts: 9
Joined: Thu Jul 31, 2014 10:05 pm
Location: Montauban, France

Re: Special characters in replacement matrix

Post by Wronschien »

Ah good !
Then my little problem will have been useful somehow.

Post Reply