Here are the mentioned scripts. The first generates MAME.lpl for a folder of ROM zip files. The other copies and renames boxart based on the lpl.
Edit: The lpl works with the XMB menu in version 1.2.2. May not work with GLUI at the moment. Later changes to Retroarch may also break the script. But it might be useful for a while until support for automatic generation of MAME playlists is built in.
;AUTOHOTKEY SCRIPT TO GENERATE MAME.lpl FOR RETROARCH
;### SETUP, ADD YOUR PATHS HERE
content =
;### MAME ROMs folder
;### example: C:\RA\RetroArch_1.2.2\content\arcade
cores =
;### cores folder
;### C:\RA\RetroArch_1.2.2\cores
dat =
;### path to a MAME ROM database file
;### example C:\files\MAME - ROMs (v0.164_XML).dat
;### get dat here http://www.emulab.it/rommanager/datfiles.php
FileDelete, %A_ScriptDir%\MAME.lpl ;clear old file
FileRead, dat, %dat%
Loop, %content%\*.zip
{
if A_LoopFileName in neogeo.zip,awbios.zip,cpzn2.zip
continue
;### you can add names of zip files in the folder to skip in the list above
name := SubStr(A_LoopFileName,1,-4) ;trim .zip
needle = <game name=.%name%.(?:| cloneof=.*)(?:| romof=.*)>\R\s*<description>(.*)</description>
RegExMatch(dat, needle, datname)
if !datname1
datname1 := name ;fallback to filename
datname1 := RegExReplace(datname1, "[/\?<>\\:*\|]","") ;replace win forbidden chars
datname1 := RegExReplace(datname1, "'","'") ;may need more replace like this
datname1 := RegExReplace(datname1, "&","&")
datname1 := RegExReplace(datname1, " \(.*","") ;trim stuff like "(World version 2.2)"
datname1 := RegExReplace(datname1, "\.$","")
;list = %xx%`n%datname1% ;for troubleshooting
i := A_index < 10 ? "000" A_index : "00" A_index
;### Next section assigns cores to games.
;### Edit filenames and corenames to what works for you
;### To use same core for all remove all lines
;### in the section below except core = fb_alpha_libretro.dll
if A_LoopFileName in asteroid.zip,dkongjr.zip,dkong.zip
core = mame_libretro.dll
else if in mslugx.zip
core = fba_libretro.dll
else
core = fb_alpha_libretro.dll
a =
(
%A_LoopFileFullPath%
%datname1%
%cores%\%core%
_
%i%|CRC
)
if (a_index == 1)
FileAppend, %a%, %A_ScriptDir%\MAME.lpl
else
FileAppend, `n%a%, %A_ScriptDir%\MAME.lpl
}
;msgbox % list ;for troubleshooting
The script outputs a MAME.lpl file in the same folder as the script. Move that to your \playlists folder. Then download a boxart image pack. Not sure if ok to link to boxart sites here so I’ll only say that you surely know how to GOOGLE and you don’t need to be a PRO TO GET TO MAME SNAPS boxart sites, if you know what I mean 
Now you’re ready to use the next script to import the boxarts.
Note: this code is the original, 2015-08-11 version. See further down in this post for the newer version needed for Retroarch nightlies released after 2015-11-24.
;AUTOHOTKEY SCRIPT TO IMPORT BOXART FOR A PLAYLIST
;### SETUP, ADD YOUR PATHS HERE
artsource =
;### Path to downloaded boxart images folder
;### example C:\boxarts
;### many good image packs exist online
;### find one with images named [romfilename].png
boxart =
;### Path to RetroArch root boxart folder
;### example C:\RA\RetroArch_1.2.2\boxart
play =
;### path to retroarch MAME.lpl playlist file.
;### also works for NES playlist and maybe other ones as well.
;### example C:\RA\RetroArch_1.2.2\playlists\MAME.lpl
if !FileExist(play) or !FileExist(artsource) or !FileExist(boxart)
return
c = 2
Loop, Read, %play%
{
if (a_index == c-1) ;rom file path line
filepath := A_LoopReadLine
else if (a_index == c) ;rom name line
{
name := SubStr(play,-7) == "MAME.lpl" ? A_LoopReadLine " (_)" : A_LoopReadLine
;MAME boxart filename format is "[gamename] ([corename]).png"
;The script assumes MAME corename is set to _ in .lpl maker script
;Other systems boxart filename format is "[gamename].png"
SplitPath, filepath, , , , OutNameNoExt
ifexist, %artsource%\%OutNameNoExt%.png
FileCopy, %artsource%\%OutNameNoExt%.png, %boxart%\%name%.png , 1
else
FileAppend, , %boxart%\%name%.txt
c := c + 6
}
}
Edit: as of at least nightly version 2015-90-20 of Retroarch, and probably some versions earlier, the boxart file naming for MAME has changed. If you use that version or some later version replace this line
name := SubStr(play,-7) == "MAME.lpl" ? A_LoopReadLine " (_)" : A_LoopReadLine
with this
name := A_LoopReadLine
Edit: new version 2015-12-29: As of 2015-11-24 nightly versions of Retroarch changed the handling of boxart again. The boxart png are now expected to be in per game system subfolders in the boxarts root directory. The format is
<boxart_dir>\Nintendo - Game Boy\Named_Snaps\Zool - Ninja of the 'Nth' Dimension (Europe).png
See here for details on that.
This updated version of the boxart script follows that subfolder format.
;AUTOHOTKEY SCRIPT TO IMPORT BOXART FOR A PLAYLIST
;### SETUP, ADD YOUR PATHS HERE
artsource =
;### Path to downloaded boxart images folder
;### example C:\boxarts
;### many good image packs exist online
;### find one with images named [romfilename].png
boxart =
;### Path to RetroArch root boxart folder
;### example C:\RA\RetroArch_1.2.2\boxart
play =
;### path to retroarch MAME.lpl playlist file.
;### also works for NES playlist and maybe other ones as well.
;### example C:\RA\RetroArch_1.2.2\playlists\MAME.lpl
if !FileExist(play) or !FileExist(artsource) or !FileExist(boxart)
return
SplitPath, play,,,, boxdir
if !FileExist(boxart "\" boxdir "\" Named_Snaps)
FileCreateDir, %boxart%\%boxdir%\Named_Snaps
c = 2
Loop, Read, %play%
{
if (a_index == c-1) ;rom file path line
filepath := A_LoopReadLine
else if (a_index == c) ;rom name line
{
name := A_LoopReadLine
SplitPath, filepath, , , , OutNameNoExt
ifexist, %artsource%\%OutNameNoExt%.png
FileCopy, %artsource%\%OutNameNoExt%.png, %boxart%\%boxdir%\Named_Snaps\%name%.png , 1
else
FileAppend, , %boxart%\%boxdir%\Named_Snaps\%name%.txt ;for quick error checking
c := c + 6
}
}