How to save AppleScript Editor Documents?
To save it as a .scpt file for AppleScript Editor:

tell application "AppleScript Editor"
    save document 1 as "script" in file ((path to desktop as Unicode text) &amp; "Hello.scpt")
end tell


To save as a plain .txt file, just change the middle line slightly

tell application "AppleScript Editor"
    save document 1 as "text" in file ((path to desktop as Unicode text) &amp; "Hello.txt")
end tell