Smörgåsbord and guest thanks for the help/examples.
I could not get the regex example code to work properly and it kept grouping items 1 less then the number I provided. So I took your examples and came up with something much longer but it works and I can understand it to fix it.
That mod function helped me group the items and that was the hardest part in figuring this out.
Below is the code that works with copying emails from a column from excel or from copying emails to clipboard.
Code: Select all
cnt := 0
list :=
;cleans up list and removes trailing null value ("") from excel
loop, parse, clipboard, `r`n
{
If (a_loopfield != "")
{
list .= a_loopfield . ","
cnt += 1
}
}
clipboard := list
sleep, 200
list :=
;formats list and breaks up into groups
;change number in mod line below to adjust group size
loop, parse, clipboard, `,
{
if (cnt <> a_index) ;check for last line in the list
list .= A_loopfield . ", "
else ;hit last line so skip adding comma space and stop loop
{
list .= a_loopfield
break
}
if ( mod(A_index, 250) == 0 ) ;change 250 to specified group size
{
StringTrimRight, list, list, 2 ;removes extra comma space at end of each group
list := list . "`n"
}
}
Clipboard := list
sleep, 200
cnt :=
list :=