Welcome Guest

Pages: 1
An action to remove or leave a certain number of words
SnowdogPostMarch 1, 2023, 04:09
Pro
Posts: 279
Registered:
March 15, 2022, 17:12
Normal topicAn action to remove or leave a certain number of words

I'm wondering if it's possible to have an action that removes a specified number of words at the beginning or end of a line & another that leaves a certain number of words at the beginning or end of a line?

I've attached a screenshot which shows track title & artist with nothing to separate them.

I need to copy all of that to the "artist" column & then remove the artist from the title & the title from the artist.

It occurs to me that they might have put the artist first so I may need to remove the set number of words from the beginning so it would be great to have "beginning" & "end" as an option.

I suspect it's a variation on the "everything before the colon" action that you wrote for me (which I've been able to go in & duplicate many times for slightly different uses) but this is eluding me.

Image

SnowdogPostMarch 1, 2023, 05:49
Pro
Posts: 279
Registered:
March 15, 2022, 17:12
Normal topicAn action to remove or leave a certain number of words

Further to this:

I managed to achieve this by modifying the existing "find character" action to find "word space" "from end" (Title field) & run that twice.

I then created a duplicate to find "word space" (from the beginning) & deselected each of the lines as they arrived at only having the name left.

Obviously, the track titles are all different lengths so I had to be careful. Also, I noticed that one of the names "Bill Le Sage" was three words, so a two word action, whilst being ideal in this scenario, would also need careful scrutiny before being run.

2MR2PostMarch 1, 2023, 07:15
Avatar photo
Administrator
Posts: 2079
Registered:
August 23, 2012, 19:27
Normal topicAn action to remove or leave a certain number of words

Hi. Am action to do this can be done. However if the text you want to remove is always the same as in the Artist field, there's a much easier way to do it. Use a Replace statement to search for the Artist field and replace it with nothing. Then do a Trim to get rid of any extra unwanted characters. Let me know if this will work. Either way I can get you an action.

I'm in and out today so answers will be spotty until tomorrow.

SnowdogPostMarch 1, 2023, 07:31
Pro
Posts: 279
Registered:
March 15, 2022, 17:12
Normal topicAn action to remove or leave a certain number of words

If I've understood you correctly, I'm not sure that would work.

What I'm starting out with is a block of type that looks like the image in the first post. There is nothing in the artist field at all. [The above block of type was created by copying the file names (minus extension) to the Title field & then replacing the underscore that existed between each word with a word space.]

So, as far as I can tell, there is no way to distinguish between that which should be kept and that which should be removed.

My thinking was: Copy the above block of text to the Artist field, delete everything except the last two words in the Artist field & keep everything except the last two words in the Title field. (The fact that one name is three words notwithstanding. I can fix that afterwards.)

Of course, once the Artist field is correct, I suppose an action could be used to remove whatever is in the artist field from the corresponding Title field, but I'd still need some way of getting the Artist field correct in the first place.

The reason I was thinking "x number of words from the beginning or end of the line" is that it might be more useful/customisable for future uses where conditions vary.

Of course, all of this assumes that I've understood you correctly. 😆

2MR2PostMarch 1, 2023, 10:37
Avatar photo
Administrator
Posts: 2079
Registered:
August 23, 2012, 19:27
Normal topicAn action to remove or leave a certain number of words

Let's try this: https://2manyrobots.com/actions/SG--Remove-Words.zip

There are two actions in the zip:

SG: Remove words (2) takes the last two words in Title and moves them to the Artist field. The moved words are removed from the Title.

SG: Remove words lets you choose 2 or 3 from the start or end ... to be moved.

SnowdogPostMarch 2, 2023, 04:02
Pro
Posts: 279
Registered:
March 15, 2022, 17:12
Normal topicAn action to remove or leave a certain number of words

That's fantastic, thanks! (Sorry, super busy yesterday. Like normal busy only I was wearing a cape!)

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