Switching script to Xcode (Making a new folder)

This is my first attempt to turn a working applescript into a running application in xcode… so i am fresh off the boat here

I’m trying to take values from a text field and create a folder with that name at a user specified location, but I keep getting:
"Can’t make contents of <> “fcbName” of <> into type string. (-1700)

I’m learning as I go here, so any help would be a plus

here’s what i got so far:

on clicked theObject
	set destination_ to (choose folder with prompt "Choose a destination for the job folder.") as string
	set fcbFolderName to contents of text field "fcbName" as string
	set prefix_ to text -5 thru end of fcbFolderName & "_"
	set clientFolderCode to contents of text field "clientCode"
	set holdingfolder_names to prefix_ & "Holding/{Old,CompArt,Transmissions}"
	
	set replace_strings to ¬
		{" ", "  ", "-", "_", "__", "~", "`", ":", ";", "!", "@", "â„¢", "'", "®", "#", "$", "?", "<", ">", "%", "^", "&", ¬
			"*", "(", ")", "=", "+", "{", "}", "[", "]", "|", "\\", "/", "'", ",", "\""}
	set astid to AppleScript's text item delimiters
	repeat with this_replace_string in replace_strings
		set fcbFolderName to my FixName(fcbFolderName, (contents of this_replace_string))
		set clientFolderCode to my FixName(clientFolderCode, (contents of this_replace_string))
	end repeat
	set AppleScript's text item delimiters to astid
	
	set fcbFolderPOSIX to POSIX path of (destination_ & fcbFolderName) & "/"
	
	do shell script ("mkdir -p " & fcbFolderPOSIX & clientFolderCode & "/" & holdingfolder_names)
	
	tell application "Finder" to update folder destination_
end clicked


on FixName(currentName, fixString)
	set AppleScript's text item delimiters to fixString
	set listName to every text item of currentName
	set AppleScript's text item delimiters to "_"
	return (listName as string)
end FixName

First, I believe to change these lines.

contents of text field

.to this:

content of text field

With text fields (if I recall correctly), using “contents” will return the contents object instead of the value your looking for.

Also, you script will need to know where to find you these text fields; that is, you must supply a full path to the object in question. That might would look like this:

text field "yourTextField" of window "yourWindow"

--or
text field "yourTextField" of window 1

Thank you… it worked

I tried:
set fcbFolderName to content of text field “fcbName” of window “Folder Generator”
and it created the folder along with all the sub folders–beautiful

I also tried changing “content” to “contents” and the same happened, all works well
so it looks like it doesn’t see a difference between “content” of text field and “contents” of text field

much appreciated for your help

Difference between content and contents:

set textField to text field "text" of window "main"

get contents of text field "text" of window "main"
--> "what I typed"
get contents of textField
--> text field id 3 of window id 1
get content of textField
--> "what I typed"