Save the selected text as a speech file

This is in the category of “because we can”, though it actually is useful at times.

This script will make a speech file from the selected text of a document that is open in DEVONthink. Allow time for processing before attempting to access the file. If you want to make a collection of text-to-speech snippets (say, for listening to later on your iPad) then save these to a folder that you index in DEVONthink. The “say” command requires the standard scripting additions to be installed – which it should be on most machines. It is not compatible with saving the .aiff files directly to DEVONhink, AFAICT. (BTW, .aiff files can be changed to .aif and used as notification tones – another “because we can” thing.)

(* 
v1.20131107.korm
Save the selected text in a DEVONthink doucment as a speech file
*)

tell application id "com.devon-technologies.thinkpro2"
	try
		say (the selected text of think window 1 as text) saving to (choose file name default name "Speech.aiff")
		
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
	end try

end tell

(Good to know: as of 20131108 there is a bug in Finder in Mavericks that crashes Finder when attempting to preview an .aiff file.)

:smiley: You never know when one of these concepts just may be the solution someone has been looking for (and maybe never thought of). thanks for another cool idea, korm.