Batch create Applescript scripts files

hi,
i need to make a script to batch create applescript files

for now i do this:


set target_folder to (choose folder with prompt "Where do you want to save your AppleScripts?") as string
tell application "Script Editor"
	set newdoc to make new document at end with properties ¬
		{contents:¬
			("beep 5") ¬
				}
	set FileName to "newscript"
	set filepath to folderr & FileName
	-- save newdoc as "application" in filepath
	-- close window FileName
	save newdoc in filepath
	close newdoc
end tell

is there a way to do that without invoquing the tell application “Script Editor” ???
is there a way to do that without launching applescript editor…

thanks

checkout the unix command line command osacompile.

From the terminal do:


man osacompile

You would use it something like this:


do shell script "cd ~/Desktop; osacompile -e "beep 5" -o myscript.app"

Kevin