File Path to Library Folder

I have the following code:

set the_file to (((path to desktop) as string) & "Data:" & filename & ".txt") as file specification

and I really need this to be stored in the Library folder in a new folder called “TypingData”, but I can’t find a way to do this without specifying the exact path, which wouldn’t work so great. Also, if the folder isn’t there I need to create it. Also, how do you delete a specific file?

Thanks.

This should create a folder named “TypingData” in the user’s Library folder.

set lib to ((path to current user folder as text) & "Library:")
set td to (lib & "TypingData:")

tell application "Finder"
	if not (exists alias td) then
		set td to (make new folder at alias lib with properties {name:"TypingData"}) as text
	end if
end tell

Now, what is it that you need to do next? Create a text file in the TypingData Folder? Where will the text file’s data come from?

– Rob

Nah, that’s got it covered. Thanks.