Not having permission to save text file

Hello, I’m having problems trying to make a text file inside a newly created folder. I’m getting the “You don’t have permissions…” I’ve tried several different approaches but still can’t get the text file to save on the new folder created.
This is what I have so far. This is the last of many tries before I gave up and came here asking for help, I tried shell script, textedit etc, but I’m not having any luck. :frowning:
Thanks for your help, really appreciate it.

set theContent to "djdklsfjklewjfiorjsdlndsklfjkld"
set thePath to (path to desktop as text) & "HD:User:etc:Job Files:1-New Jobs:"
set theSubject to "subject"

tell application "Finder"
	make new folder at thePath with properties {name:theSubject}
end tell

tell application "TextEdit"
	--activate
	make new document
	--set name of document 1 to theSubject
	set text of document 1 to theContent as text
	save document 1 in (path to desktop as text) & "test.txt"
	close
end tell

You can’t treat paths as files – you need actual files. Try this:

set theContent to "djdklsfjklewjfiorjsdlndsklfjkld"
set thePath to (path to desktop as text)
set theSubject to "subject"

tell application "Finder"
	make new folder at folder thePath with properties {name:theSubject}
end tell

set theDest to (thePath & "subject:test.txt") as «class furl»
tell application "TextEdit"
	--activate
	make new document
	--set name of document 1 to theSubject
	set text of document 1 to theContent as text
	save document 1 in theDest
	close
end tell

Thanks Shane, and thanks for your ASOC book too! :slight_smile: