Add to Each Line on Clipboard?

I have a list of song artists and titles taken from a cleaned-up M3U playlist. I need to turn each item in the list into a link to search Amazon Digital Music for the song, but I don’t know how to do that. Could someone help?

I’ll be starting with a list of 25-30 songs formatted like the following:

Judas Priest - Johnny B. Goode 
Chuck Berry -  Johnny B. Goode 

And I want to finish with:

<a href="https://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Ddigital-music&field-keywords=Judas+Priest+Johnny+B.+Goode&tag=iampariahcom-20&camp=1789">Judas Priest - Johnny B. Goode</a>
<a href="https://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Ddigital-music&field-keywords=Chuck+Berry+Johnny+B.+Goode&tag=iampariahcom-20&camp=1789">Chuck Berry -  Johnny B. Goode</a>

So far I have KM copying the entire list to a named clipboard (“Temporary”). I understand that I need to somehow tell KM to process each line of the named clipboard individually, perform the needed replacements and prefixing and suffixing, and then write it back as a solid list to the same Temporary clipboard for pasting. I just don’t know to do any of that.

Does anyone know how to link to iTunes for such a search? I would ideally like to create a list that has an iTunes icon linked to the song there, an Amazon icon linked to the song there, and then the “Artist - Song” name not hyperlinked.

Try this:

[test] Regex for Amazon Link.kmmacros (4.5 KB)


These are my iTunesStore search templates in LB (the asterisk is the query):

Store:

itms://phobos.apple.com/WebObjects/MZSearch.woa/wa/search?term=*

Store: Album:

itms://phobos.apple.com/WebObjects/MZSearch.woa/wa/advancedSearchResults?albumTerm=*

Store: Artist:

itms://phobos.apple.com/WebObjects/MZSearch.woa/wa/advancedSearchResults?artistTerm=*

Store: Composer:

itms://phobos.apple.com/WebObjects/MZSearch.woa/wa/advancedSearchResults?composerTerm=*

Store: Song:

itms://phobos.apple.com/WebObjects/MZSearch.woa/wa/advancedSearchResults?songTerm=*
1 Like

Tom, you are my hero. Thank you very much!

Your macro worked perfectly, and I was able to add in functioning iTunes links, too because of your examples. This is for my new streaming Internet radio show/podcast at http://PariahRocks.com, by the way.

A previous macro sets the Temporary clipboard with a cleaned up list from the M3U playlist.

Here's what I ended up with.

HHH Playlist Buy Now Links.kmmacros (6.1 KB)

Great! Thanks to your link I’ve learned that my little Bluetooth speaker has something like bass :laughing:

Hahaha