this is a bit clumsy cos I just dashed it off quickly, but instead of entering the text into the script, loop through the files.
And instead of looping through each line, just work with the requisite strings (should be faster)
#singleinstance, force
setbatchlines, -1
fileselectfolder, myfolder, *%a_workingdir%
loop, %myfolder%\*.txt,0,1
{
tooltip, %a_index% - %a_loopfilename%
newfile:= a_loopfilename
stringreplace, newfile, newfile, `., _.,all
loop,read, %myfolder%\%a_loopfilename%
{
stringleft, xx, a_loopreadline,1
stringupper, xx, xx
stringtrimleft, yy, a_loopreadline, 1
tmp_.= xx . yy . "`n"
}
fileappend, %tmp_%, %myfolder%\%newfile%
tmp_:=
}
input files must be text, and output will be to a new file ie output from SOURCEFILE.TXT will be to SOURCEFILE_.TXT