Here's some code I wrote in Applescript that does the same thing. It saves JPGs, but it could easily be changed to save to any file format. It will take your layer names and remove unwanted characters and spaces first, then turn them into filenames. For example, "Layer 1 / Zig Zag Texture" would become "Layer1ZigZagTexture" Then it appends the name of the file to each JPG you save out. set noChar to {".", "/", ":", " "}
tell application id "com.adobe.illustrator"
activate
tell current document
set pathToContainer to POSIX path of ((file path as string) & "::")
set AppleScript's text item delimiters to "."
set fileName to first text item of (name as string)
set AppleScript's text item delimiters to ""
set c to count of layers
set visible of every layer to false
repeat with i from 1 to c
set visible of layer i to true
set layerName to name of layer i as string
set layerName to my remove_chars(layerName, noChar)
set thisJPGName to fileName & "_" & layerName & ".jpg"
set pathString to pathToContainer & thisJPGName
export to file pathString as JPEG with options {class:JPEG export options, artboard clipping:true, quality:80, horizontal scaling:100, vertical scaling:100}
set visible of layer i to false
end repeat
set visible of layer 1 to true
end tell
end tell
on remove_chars(this_text, searchList)
set c to count of searchList
repeat with i from 1 to c
set AppleScript's text item delimiters to item i in the searchList
set the item_list to every text item of this_text
set AppleScript's text item delimiters to ""
set this_text to the item_list as string
end repeat
return this_text
end remove_chars
... View more