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