form dialogue
	sentence openpath D:\3工作\2019年上半年\语音研究专题\2019年4月19日上课材料\将文本内容添加到TextGrid中
endform

if right$(openpath$,1)<>"\"
	openpath$=openpath$+"\"
endif

Read Strings from raw text file... D:\3工作\2019年上半年\语音研究专题\2019年4月19日上课材料\将文本内容添加到TextGrid中\content.txt

Create Strings as file list... fileList 'openpath$'*.TextGrid
numberOffiles=Get number of strings
for ifile from 1 to numberOffiles
	select Strings fileList
	fileName$=Get string... 'ifile'
	Read from file... 'openpath$''fileName$'

	simpleName$=fileName$ - ".TextGrid"

	select Strings content
	contentOfSen$=Get string... 'ifile'
	
	select TextGrid 'simpleName$'
	Set interval text... 1 2 'contentOfSen$'
	Write to text file... 'openpath$''fileName$'

	select TextGrid 'simpleName$'
	Remove

endfor

select Strings content
plus Strings fileList
Remove

exit OK!

