Welcome Guest

Pages: 1
Prepend Title for Multiple Items
noforkerPostNovember 6, 2016, 21:26
Newbie
Posts: 17
Registered:
July 25, 2016, 01:03
Normal topicPrepend Title for Multiple Items

Are there any sample actions that will help me prepend the title field when multiple tracks are selected?

I'd like to have an action where I could select two or more tracks, then specify text to prepend, and end with these results: [SPECIFIED PREPEND TEXT][EXISTING TITLE FIELD TEXT].

I've tried building one. The prepend works, but all the selected tracks end up with the same title: [SPECIFIED PREPEND TEXT][EXISTING TITLE FIELD TEXT OF FIRST SELECTED TRACK].

Any help would be appreciated. Yate is great, and I can see that it is very powerful! I'm excited to learn more about creating actions and look forward to replacing the "Doug's Scripts" I used to use when I was using iTunes instead of Plex.

Thanks,
Neil

2MR2PostNovember 6, 2016, 21:50
Avatar photo
Administrator
Posts: 2087
Registered:
August 23, 2012, 19:27
Normal topicRe: Prepend Title for Multiple Items

Agh! I have to build in a Prepend statement. People see the older Append statement and do not understand why Prepend does not exist. The Set statement is far more powerful 🙂

Using Set and the context menus to include other fields you can pretty much do anything.

What you want are the following two lines:

Prompt for Text "Specify the text to prepend" save text to named variable 'text' Hide Info
Set the Title field to "\<text>\[Title]"

The \[Title] sequence is the escape sequence representing the current value of the Title field. You don't have to remember the escape sequences as they can all be generated via context menus.

I've uploaded the action to:

https://2manyrobots.com/actions/noforker-Prepend-Text-to-Title.zip

Drag the unzipped plist file to the main file list area or do a Yate>Import Preferences.

Beware if you're reading this via email. The mailer strips off backslash characters.

Have fun.

2MR2PostNovember 6, 2016, 22:26
Avatar photo
Administrator
Posts: 2087
Registered:
August 23, 2012, 19:27
Normal topicRe: Prepend Title for Multiple Items

Yep, all the fields can be read and written indirectly. You could prompt for a field (supply a picker control) and then prompt for the text. You could read the old field contents using an escape sequence and set the new using the Set Indirect statement.

A simplistic example is:

Set named variable 'text' to "prepend text"
Set Variable 1 to "Title"
Set Indirect '\v1' to "\<text>\=1"

noforkerPostNovember 7, 2016, 09:39
Newbie
Posts: 17
Registered:
July 25, 2016, 01:03
Normal topicRe: Prepend Title for Multiple Items

That makes sense. Would the picker control have to be implemented externally, or is there a way to do it via an action?

2MR2PostNovember 7, 2016, 11:04
Avatar photo
Administrator
Posts: 2087
Registered:
August 23, 2012, 19:27
Normal topicRe: Prepend Title for Multiple Items

Nothing is implemented externally 🙂

The picker is simply an optional disclosure button on the Prompt for Text statement. The implementation is quite simplistic. You provide a list is a well known named variable (Prompt for Text List) where each element is separated by the Default List Delimiter (\~). If you choose an item, it is appended to the text field.

e.g..

Set named variable 'Prompt for Text List' to "Title\~Artist\~Album Artist\~Album"
Prompt for Text "Pick a field to modify" save text to named variable 'User Input' Show picker Hide Info

noforkerPostNovember 7, 2016, 17:04
Newbie
Posts: 17
Registered:
July 25, 2016, 01:03
Normal topicRe: Prepend Title for Multiple Items

Yeah! Ok. Great! It's time for me to start making some actions. It would be nice to have a repository for user created actions. Or, is there one already and I'm missing it?

2MR2PostNovember 7, 2016, 22:12
Avatar photo
Administrator
Posts: 2087
Registered:
August 23, 2012, 19:27
Normal topicRe: Prepend Title for Multiple Items

The Yate Resource page accessible off the Help menu, has lots of resources.

Pages: 1
Mingle Forum by Cartpauj | Version: 1.1.0beta | Page loaded in: 0.03 seconds.