tell application "Finder" to set basePathToNotesFolder to (path to desktop) & "Mail Manager Folder" as text
set thePath to POSIX path of basePathToNotesFolder
tell application "TextEdit"
activate
if not (exists document 1) then
tell application "System Events" to tell process "TextEdit"
keystroke "n" using command down
keystroke "This is a test"
end tell
end if
tell application "System Events" to tell process "TextEdit"
delay 1
keystroke "s" using command down
delay 0.2
keystroke thePath --< will save as RTF or RTFD
keystroke return
delay 0.2
keystroke "a" using command down
delay 1
keystroke "Name of file"
--keystroke "d" using command down
delay 1
keystroke return
delay 1
end tell