1. merge 2 lists
2. sort them alphabetically
3. format a new list as such
any tips would be greatly appreciated.
Code: Select all
;reference template
/*StringReplace, NoComp1, NewStr1, Ayala, , All
StringReplace, NoComp2, NoComp1, Byrnes, , All
StringReplace, NoComp3, NoComp2, Coates, , All
StringReplace, NoComp4, NoComp3, Cornish, , All*/
word1 = StringReplace
word2 = NoComp
word3 = NewStr
old_composers = Adams,Zebra,Smith
new_composers = Charlie,Quigley
Loop, parse, old_composers, `,
{
theList = %theList%`n%A_LoopField%
}
Loop, parse, new_composers, `,
{
theList = %theList%`n%A_LoopField%
}
sort, theList
msgbox, %theList%
x=1
y=2
StringReplace, new_theList, theList, <br>,`n, All
Loop, parse, theList, `n ;Parse the string based on the cent symbol.
{
msgbox, %A_LoopFileName%
}
loop, parse, %theList%, ',
{
if %A_Index% = 1
newlist2 = %word1%, %word2%y, %word3%x, %A_LoopFileName%, , All
if %A_Index% > 1
newlist3 = %newlist2%`n%word1%, %word2%y, %word3%x, %A_LoopFileName%, , All
x++
y++
return
}
;msgbox, %newlist3%
/*
here is the desired result:
StringReplace, NoComp1, NewStr1, Adams, , All
StringReplace, NoComp2, NoComp1, Charlie, , All
StringReplace, NoComp3, NoComp2, Quigley, , All
StringReplace, NoComp4, NoComp3, Smith, , All
StringReplace, NoComp4, NoComp3, Zebra, , All
*/