Removing “ and , from list

I have a list of values that I would like to store as a variable and use the variable as text in a do shell script command.

At the moment the values are stored as a list : “cat”, “dog”, “bird” and if I used the variable in the shell script it would read
tag -f “cat”, “dog”, “bird”

When I need it to read

tag -f cat dog bird

Does anyone know how I would remove the quotes and commas?

Probably by using a string and appending the elements of your list to that string in a loop.
In JavaScript, I’d write list.join(' '). AS is probably a bit more longwinded.

property theList : {"cat", "dog", "bird"}

activate
set searchInFolder to quoted form of POSIX path of (choose folder)

set text item delimiters to " "
set theList to (theList as text)

set theResult to do shell script "/usr/local/bin/tag -f " & theList & " " & searchInFolder

You never posted the actual AppleScript you were using, so we can see what you are doing wrong!

Ok, here it is. The data will be musical notes not animals

`use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
use framework "Foundation"
-- use script "Myriad Tables Lib" version "1.0.9"

property twelfth_root_2 : (2 ^ (1 / 12))
property theNotes : {}
set fRoot to text returned of (display dialog "Choose fundamental frequency in Hertz" default answer "") as text
-- if text returned of result contains {("A") ("Bb"), ("B"), ("C"), ("Db"), ("D"), ("Eb"), ("E"), ("F"), ("Gb"), ("G"), ("Ab")} then¬
-- set fRoot to {"440.0", "493.88", "466.16", "523.25", "415.3", "392.0", "369.99",  "349.23",  "329.63",  "311.13",  "293.66",  "277.18"}

display dialog "Choose fundemental frequency in Hertz" default answer ""
if text returned of result is "A" then
	set fRoot to 440.0
else if text returned of result is "B" then
	set fRoot to 493.88
else if text returned of result is "Bb" then
	set fRoot to 466.16
else if text returned of result contains "C" then
	set fRoot to 523.25
else if text returned of result contains "Ab" then
	set fRoot to 415.3
else if text returned of result is "G" then
	set fRoot to 392.0
else if text returned of result contains "Gb" then
	set fRoot to 369.99
else if text returned of result contains "F" then
	set fRoot to 349.23
else if text returned of result is "E" then
	set fRoot to 329.63
else if text returned of result contains "Eb" then
	set fRoot to 311.13
else if text returned of result is "D" then
	set fRoot to 293.66
else if text returned of result contains "Db" then
	set fRoot to 277.18
else
	set fRoot to text returned of result
end if


-- *The froot dictates the key signature and the presets below are relative intervals, (2 ^ (1 / 12)) will calculate the frequency of the intervals in relation to the fRoot frequency. Whilst I understand the maths credit goes to Nigel Garvey for the next section, he helped me out a year ago but I suffered a meltdown and have only just picked it back up *
set presets to {"b9", "9th", "m3", "3rd", "4th", "Dim5", "5th", "Aug5", "6th", "7th", "m7", "Oct"}
set theMode to (choose from list presets with prompt "Choose a character:" with multiple selections allowed)
if (theMode is false) then return -- user cancelled

set frequencies to {}
repeat with semitones from 1 to (count presets)
	if (theMode contains {item semitones of presets}) then
		set frequency to (fRoot * (twelfth_root_2 ^ semitones))
		
		set end of frequencies to ¬
			frequency -- (frequency / 2, frequency * 2, frequency * 4, frequency * 8, frequency * 16, frequency * 32, frequency * 64)
		
	end if
end repeat

log frequencies

set theNotes to {}
set freqList to {15.9, 16.81, 17.81, 18.81, 19.91, 21.22, 22.48, 23.81, 25.23, 26.72, 28.31, 30.0, 31.79, 33.67, 35.67, 37.79, 40.41, 42.41, 44.94, 47.61, 50.44, 53.44, 56.61, 59.13, 62.66, 66.37, 70.32, 74.5, 78.92, 83.62, 88.59, 93.86, 99.44, 105.35, 111.61, 118.25, 125.28, 132.72, 140.62, 145.98, 157.83, 167.22, 177.16, 187.7, 198.86, 210.68, 223.21, 236.48, 250.54, 265.45, 281.22, 297.94, 315.67, 334.44, 354.32, 375.38, 397.71, 421.35, 446.41, 472.95, 501.07, 530.87, 562.44, 595.88, 631.31, 668.86, 708.63, 750.76, 795.4, 842.7, 892.81, 945.89, 1002.15, 1061.73, 1124.87, 1191.76, 1262.62, 1337.7, 1417.25, 1501.52, 1590.8, 1685.39, 1785.61, 1891.79, 2004.27, 2123.45, 2249.72, 2383.5, 2525.23, 2675.39, 2834.48, 3003.15, 3181.58, 3370.78, 3571.21, 3783.56, 4008.55, 4246.91, 4499.44, 4766.99, 5050.45, 5350.76, 5668.93, 6006.03, 6363.17, 6741.54, 7142.41, 7567.12}
set noteList to {"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"}
-- *This stage will convert the chosen interval frequencies to the 12 note tempered scale equivalent *
set oldDelims to text item delimiters
set text item delimiters to ","
repeat with a_reading in frequencies
	set y to (contents of a_reading)
	-- set y to y as real
	set hi to (count of freqList)
	set lo to 1
	if y < item 1 of freqList or y > item hi of freqList then
		set thenote to "xxxx"
	else
		repeat while true
			set i to ((hi + lo) div 2)
			if i = lo then
				exit repeat
			else if y > item i of freqList then
				set lo to i
			else
				set hi to i
			end if
		end repeat
		set thenote to item i of noteList
	end if
	log thenote
	set y to thenote as text
	set end of theNotes to y
end repeat
return theNotes
set text item delimiters to " "
set theNotes to (theNotes as text)
-- tag -f is a cli command that will search for files with tags
set theResult to do shell script "/usr/local/bin/tag -f " & theNotes

`
I haven’t used Shanes MetaLib before, so don’t really know what the most efficient way to work with the files would be. Im thinking of putting together a pretty complex table or dialog box that has 6/7 drum categories each with checkboxes to select any or all of the 12 intervals. Though Im quite tempted to take the easy option and make a gui with Xcode. Does anyone know if they fixed the issue with linking the UI to applescripts?

I’m confused.
You have a “return theNotes” before it ever gets to a “do shell script”

when I removed it my do shell script gets this:

/usr/local/bin/tag -f A# C D#

notice no quotes. Isn’t this what you wanted?