I've got a file with about 50 different text blocks pulled in using Variable data, and I want to save out 3 different PNGs and a SVG for each. When I set up an action script for the Batch function, it only seems to save out the last item listed in the Asset Exporter. What am I missing or do these not work together?
when you save things with an action, they get the same name each time. so when the batch function runs the action on the first item, it'll save the file as "name_of_file.png" and "name_of_file.svg". On the next item, the expected output is something like "name_of_file_2.png" and "name_of_file_2.svg", and so on and so forth.
Unfortunately, when you create your action, you're effectively hard coding the output file name into the action, so each time the action runs, it saves a file with the same name, overwriting any previously saved files. So each execution of the action saves over the previously saved file, then you're only left with the last one since there's nothing else to come along and overwrite that one.
You'll need to implement a script that creates a dynamic action (basically building the action via script on the fly and passing in a new file path) on each execution to ensure the file path is unique each time through.
I'm not quite sure if that is the real issue Ori is talking about in this case, Dilliam.
I will try to understand it tomorrow. Just tomorrow because I'm too tired to do it at the moment.
As @DilliamWowling mentioned, it's possible to record an action for Asset Export. However it's rather prohibitive when used within the context of Batch Action Processing. The first non-starter is that while you may have the ability to create a script that creates an Asset Export action, it will simply crash your Illustrator because when you are already playing an action and it plays a script that plays an action, it crashes. The second one is, I just recorded me an action that exports 2 artboards and saw that it actually records an "event" for every artboard. Each such event comes with a very cryptic set of parameters which take a scientist to decipher even when decoded. The payoff using such an action (outside of batch processing via the native actions method) is that it (hopefully) takes care of what you'd have to do otherwise, which is to create code needed to separate the art from the rest of the document by creating a new document and duplicating just the art you want into it. However, the parameters aspect of such an action is considerably worse compared to the documented (and mostly working) scriptable exporting methods which have their parameters defined in documentation and the Types-For-Adobe typescript declarations.
So, if I was doing it I would cut straight to making a script that does your export by coding the procedure to isolate your asset and produce the various formats needed. Unfortunately, it does not look like Illustrator scripting is capable of being aware of what your actual assets are in the Assets panel, so that also creates a user-vs-automation scenario where stuff that is made to make UI manual operations easy is actually less useful in the context of automation. Considering this, even if you were to not use the native batch processing and were to go on a path of creating such an action via scripting, if you do not use artboards but the assets panel instead, it's still useless.
I probably sound like the Debbie-downer, but I hope that someone may come along who knows a secret function that allows us to see what assets there are and all the rest.
Ha! I have found the secret documentation, it is in this forum post! https://community.adobe.com/t5/illustrator/what-s-new-in-illustrator-scripting-cc2018/td-p/9422236