AppleScript Xcode ui project

Hey there. This is a bit of a long one. I have a script in AppleScript that I’d like to work into an Xcode project. I’d like to have a box to select a global setting,13 checkbox categories each with 12 checkbox sub categories. Here’s the as code I have so far


use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
use framework "Foundation"


property twelfth_root_2 : (2 ^ (1 / 12))

 # this routine sets the global value I’d like to ,choose from a text field in Xcode 
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 contains "A#" then
	set fRoot to 466.16
else if text returned of result is "C" then
	set fRoot to 523.25
else if text returned of result contains "G#" 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 "F#" then
	set fRoot to 369.99
else if text returned of result is "F" then
	set fRoot to 349.23
else if text returned of result contains "E" then
	set fRoot to 329.63
else if text returned of result contains "D#" 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 "C#" then
	set fRoot to 277.18
else
	set fRoot to text returned of result
end if


# this list is a list of the 12 subcategories I would like to add as check boxes for each category 
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
# this routine using the global setting fRoot returns a list of values calculated using the multiple selections allowed list items 
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 
		
	end if
end repeat

log frequencies
# this routine converts the frequency results in to the finder tagged equivalent 
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"}

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
set theNotes to theNotes as list

set theTag to {}
# this returns a list of lists with all the files whose tag contains items 1 thru count of theNotes
repeat with aNote in theNotes
	set y to text item 1 of aNote
	set theTags to do shell script "/usr/local/Cellar/tag/0.10_1/bin/tag --find " & y & space & "~/Desktop/EXSali/"
	set theList to every paragraph of theTags

	set end of theTag to theList
	
end repeat
return theTag

I’d like to implement this routine to every category, each category whose check box is ticked, will call a handler that will create a list of every file with a specific tag relating to that category, the resulting file list of each category should then be stored and then passed through theMode tag results. Ie a file list for
Category 1 (files with the tag Bass Drum) that contain items from theNotes - b9, m3 aug5
Category 2 (files with the tag Snare Drum) that contain items from theNotes - 4, 5, m7
Category 3 (files with the tag Floor To. ) that contain items from theNotes - 9, M3, M7
Etc…

I’m not expecting any one to respond with a whole script but any advice on how to go about writing it would be much appreciated.

Do you want to know about AppleScript on Xcode?

Is that available in English, too?

Hmm… English version of some ebook did not make good sales.
So, I thought English scripters does not want or read books.
I’m deeply disapponted.