Thursday, March 29, 2012

Matthew Ericson's MultiExport

Reader Dan just alerted me to the existence of Matthew Erickson's awesome multiExport script. His script is very similar to my exportLayers script in that it will export selected layers as various image files, but his script also manages to export layers as PDF files, and can handle multiple artboards at the same time.

The only downside is, I believe it only works for CS5 and above.  So if you're rocking CS5, check out Matt's script and his incredibly clear and thorough walk-through of how it works on Matt's blog.

I had a lot of fun looking through how he solved the dialogue/ persistent data issue. My solution was to write an entire script on the fly, and then export the script and execute it remotely.  I think Matt's closure solution is much more elegant.

Also, to save variable state between runs, his script generates an XML string, and stores it in a new textField in a hidden layer on the top of the document and then on the next run, the dialog can remember the selected values. Mad Genius. I love seeing solutions that think farther outside the box than my own efforts. 

Props to Matt for providing this open source, and for sharing his work with the world. Matt, you sir, are a Hacker with a capital 'H', and I mean that in the best possible way. 

Saturday, March 17, 2012

Draw control handles as geometry

All the anchor points and control handles below are actual geometry!

Want to be able to actually draw an objects control handles AS geometry? I have occasionally wanted this functionality while creating my script icon illustrations for 'scallop' and 'zoom and center', but I always did so by hand.

It occurred to me that this would be a good script to write,  but after doing a little Googling, I discovered that GFBroo of Jongware beat me to the punch on this one.

The discussion on the Adobe forums is here, and the direct download to the script is here.

 Very handy.... Thank's GFBroo!


Tuesday, March 13, 2012

Flow Text box to fit contents

A few days ago, Johan Ronsse requested a script that expands a text area's size to match it's containing text when some of the text is hidden by overflow.   I realized the utility of such a script, but after checking illustrator's API, I could find no native way to do it.  A few hours later, Johan sent me this link.

Nathaniel Kelso found a way to make it work.  Nathaniel's script used a really cool trick in which he grows the container, then makes a copy of the text, and flattens the text into geometry. Once the text has become a collection of graphic objects, it becomes trivial to get it's correct size. The script then deletes the geometry, and re-sizes the original text box to the correct dimensions. Brilliance!!!

Download it... Use it, and remember to send Nathaniel a thank you if you use it.
For me this was a great reminder that if you're against a wall, ask someone else.  There are always so many creative ways to solve a problem.
Stay inspired!!!

How to permanently tie a script to an action in Illustrator

 Over the years, the number one request from my followers has been the ability to permanently connect a script to an action.  
 (Note: This post is only slightly tongue in cheek)
Step 1: Go here:

Step 2: Enter this:
*****Bug Report*****
Steps to reproduce bug:

 1. Make a new Action
 2. Open Action panel fly-out
 3. Select "Insert menu Item"
 4. Insert the name of a custom script from the scripts folder.
 5. Stop recording, and test the new Action. It properly runs the script.
 6. Close, and re-open Illustrator.
 7. Run the Action... Watch it fail.

Step 3: Repeat as needed until it's fixed.

Seriously, do this at least once, and when it's finally fixed, you can claim that you played a part in making AI a better product. I'd totally put that on my resume. :)

Wednesday, March 07, 2012

The "Select Anything" Plug-in

While the script in the previous post can be easily modified for any object type, Egor just pointed out that there is a cross platform plugin called selectMenu.aip available for free from Rick Johnson/Graffix that will allow you to select many different object types. I'd perused the bevy of handy tools on Rick's site a long time ago, but had forgotten the treasures to be found there. To avoid such foolish oversight in the future, I will add Rick's site to the blogs link panel.


Tuesday, March 06, 2012

Select Compound Paths only

I got a request today to write a script that selects only compound paths. Here's the quickie script:

var doc=activeDocument;
var sel = doc.selection;

var len = sel.length;

        if(sel[len].typename ==="CompoundPathItem"){
alert("Only non-compound items are selected."); 

It should work for all versions of illustrator, and can easily be modified to other object types.



Thursday, March 01, 2012

Export Layers (up to 700% larger)

Since I posted the Export Layers script, a few people have asked me to add an option to export at a higher resolution. There is no DPI export option listed in the Adobe scripting guide, so it didn't seem likely to happen.
Yesterday, however, I received an email from Mike Moreau Jr. at HarvestMedia, who pointed out that there was an option to scale exported images.  Aaaannd, shortly thereafter, I added scaling sliders to the scripts UI.

If you need an image exported at, say, 300dpi, just calculate (desiredResolution/currentResolution) eg, 300/72 gives you 4.17.  By Setting the scale slider to 417%, your output should export at the correct size.

Note: Technically, your image is still at 72 dpi, it's just much larger, so if you want true 300dpi images, you'll need to batch process your exported images using Photoshop to adjust the size and dpi.

Also, I updated my previous post on 'organize', adding a new pic, and some notes on pro mode.