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!

enjoy!
-J

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.
http://kelsocartography.com/blog/?p=316

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!!!
-J

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:
https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

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. :)
-J

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.

cheers,
-J

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;

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


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

enjoy!

-J

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.

Saturday, February 25, 2012

Organize

Egor from Russia has been sending me some really good ideas for scripts lately. Last week he sent a request for a script that would 'sort by size'. I immediately slapped my forehead and wondered how I didn't think of that.

Here was his request illustration:



After goofing around a little, I thought, why settle for just positioning?
Let's make something that allows you to sort a collection of objects ALONG any attribute, BY any attribute.
 Thus organize was born. Below are a few test runs to get your juices flowing. Oh, and I added random distribution too.

Edit: Adding another example:
I've added a 'shortcuts' option, so once you get used to the options, you can enter a four digit sequence into the first prompt and the items will be sorted. I believe this interface is a good balance between hand-holding for the beginner, and speed/ efficiency for the power user.

Below I use the code to shuffle a deck of cards, and then sort their z-order depth from left to right based on their x-position. I start with a properly sorted deck:


Let me know if/how you use it in the comments, and as always, happy illustrating!

Wednesday, January 25, 2012

For the Birds

Daniel van Willigen's up to his old tricks with a new script, and it seems, a nice new place to show them off on the Behance Network.  Daniel has really taken JS4AI, and dialogues to the next level with this one.



I'll leave it as an exercise for the reader to come up with a use for it. Personally I'd just keep it around to run when I'm feeling down. Those silly birds just exude 'everything's gonna be alright...'


Also, if you're on a Mac, check out his cool new 'InfoPanel' script, which prints out assorted bits of standard printing info in a panel beneath your illustration.

Very professional looking.
Daniel assures me this will work on PC in it's next iteration.
cheers,
-J