Patterns, new scripts

Main discussion forum
Post Reply
hopalongrock
Sr. Member
Sr. Member
Posts: 289
Joined: Wed Sep 15, 2010 1:38 pm

Patterns, new scripts

Post by hopalongrock »

In the example from the help text
" %#U1|2|# - #% returns the second token of the U1 variable if applicable "
the text between the second and third # , namely " - " (without the quotes) is the token separator ?

Is %#D|2|# - #% equivalent with %D2% using " - " separator ?

I see the pattern usage in #filter_track_album.scv, although gTag.ParseValue( '%#A|2|#-#%', false, false, false ) isn't explained in the help.

..........

What is the purpose and the usage of the .scv scripts ?
For example how can I use a script like #filter_track_album.scv ?

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

Re: Patterns, new scripts

Post by jtclipper »

Pattern variables use a specific syntax

Code: Select all

%# | | %
The | is needed to separate the variable into 3 groups
The first group is the %variable% name and it's value will be parsed against the mask defined in group 3, group 2 is the token number

Code: Select all

%#D|2|# - #%
will yield the %D% variable's 2nd token for this specific mask '# - #' mask characters in those variables use the # character

Code: Select all

gTag.ParseValue
is a new function, the help file will be updated with the new functions. it's purpose is to expand variables to real values

The new .scv scripts are code snippets that contain arbitrary logic and set a return value, they can be used anywhere normal %..% variables are used
For example in the filter you can select

Code: Select all

%@#filter_track_album.scv% = 1
this variable will return '1' when a specific condition are met, and will behave like a simple variable otherwise

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

Re: Patterns, new scripts

Post by hopalongrock »

Sorry, although I read the syntax is %# | | % , the example misguided me, and I thought, that the 2nd and 3rd # is the part of syntax.
Only to see, that I understand well: Is %#D|2| - % equivalent with %D2% using " - " separator?

Is the "@" character part of the syntax in %@#filter_track_album.scv% = 1 or only a typo?

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

Re: Patterns, new scripts

Post by jtclipper »

This is missing the pattern parameter

Code: Select all

%#D|2| - % 
This is the correct value:

Code: Select all

%#D|2|# - #% 
'#' represents the tokens and '-' is the separator
Another example would be:

Code: Select all

File name: 01.Eagles - Hotel California
%#F|1|#.#-#% -> 01
%#F|2|#.#-#% -> Eagles
%#F|3|#.#-#% -> Hotel California
The syntax is

Code: Select all

%@scriptfilename%
%@#filter_track_album.scv% is correct the '@' is needed to declare the variable as a script one, those will also appear in the pop menu under the user sub-menu.

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

Re: Patterns, new scripts

Post by hopalongrock »

jtclipper wrote:

Code: Select all

%#D|2|# - #% 
'#' represents the tokens and '-' is the separator

Code: Select all

File name: 01.Eagles - Hotel California
%#F|1|#.#-#% -> 01
%#F|2|#.#-#% -> Eagles
%#F|3|#.#-#% -> Hotel California
I would put both example and explanation in the help !
Am I right, that this is equivalent to the mask used in the options/use mask, only # appears instead of % ? In this case maybe we could use # in options/use mask too , instead of % ?
jtclipper wrote:The syntax is

Code: Select all

%@scriptfilename%
%@#filter_track_album.scv% is correct the '@' is needed to declare the variable as a script one, those will also appear in the pop menu under the user sub-menu.
Great, thank you.

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

Re: Patterns, new scripts

Post by jtclipper »

The Help file will receive a few updates and these examples are nice to have so I'll put them there.

I thought about using # instead of % in the masks also and will probably go ahead and do it taking care of the older option automatically.

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

Re: Patterns, new scripts

Post by hopalongrock »

Thank you !

Post Reply