Got lucky with an answer the first time, thought I'd try again. In Illustrator CS5+, I'm looping through the objects in a document, exporting each of them to an image using exportArtBoardasImage(). They need to be trimmed afterwards, as they generally have a tonne of whitespace. Normally, I run an ImageMagick shell script (mogrify -trim). It'd be awesome if I could reproduce this functionality from within illustrator. I've seen people handle this by copy-and-pasting each object into a new file, sizing the artboard to that object, exporting, then closing the file. I'd rather not do this, as it's *way* too slow. Any other suggestions?
Just doing some research on this on my own...I've found a method: "fitArtboardToSelectedArt()"...but because I'm using the document selection to loop through objects, I always have everything selected all at once. Is there possibly a way to save a selection, deselect everything, and select just one thing, then regain the selection again?
"I have everything selected…" It is better not to use selections where possible… If you want everything just loop pageItems? And to the OP you can loop almost anything chaning the artboard as you go… No need for ImageMagik