form dialogue
	sentence openpath C:\Users\dell\Desktop\2020年4月28日声音与标注文件的切分与合并\合并
	sentence savepath C:\Users\dell\Desktop\2020年4月28日声音与标注文件的切分与合并\合并
endform



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


Create Strings as file list... fileList 'openpath$'*.wav
numberOffiles=Get number of strings

for ifile to numberOffiles
	select Strings fileList
	fileName$=Get string... 'ifile'

	Read from file... 'openpath$''fileName$'
endfor
	select all
	minus Strings fileList
	Concatenate
	Write to WAV file... 'savepath$'合并.wav

	select all
	minus Strings fileList
	Remove

for ifile to numberOffiles
	select Strings fileList
	fileName$=Get string... 'ifile'
	
	simpleName$=fileName$-".wav"
	textGridName$=simpleName$+".TextGrid"
	Read from file... 'openpath$''textGridName$'
endfor

	select all
	minus Strings fileList
	Concatenate
	Write to text file... 'savepath$'合并.TextGrid

	select all
	Remove

exit OK！所有声音文件、标注文件已经合并！

