Wednesday, February 26, 2014

Select Text By Size

Hi All,

I was just asked by user Seth if it was possible to write a script that would select text by a given size in Adobe Illustrator.
So I now present to you, my newly added script "selectTextBySize."  Honestly, I'm not sure why I didn't write this years ago... I would assume that I didn't because someone else had already written something similar. In any case, now you have my version...

This simple script just scours the current open document and selects all text of a given pixel size.
The default behavior of the script is to unlock text and layers if the correct sized text is locked or hidden.
This behavior can be changed by swapping the variables at the top of the script.

Hope you find this useful.

Update 3/19/14:
Just added range selection so you can grab text between, for example, 5px and 25px, or whatever...


Thursday, December 20, 2012

Hey All,

 I just got a message on  from user Vaughn, who was having problems getting copyToObject working in CS6.  He didn't leave an email, so I'm responding here. I've tested the script in CS6 on PC, and it seems to be working fine.  Vaughn, if you read this, please send me the problematic file so I can troubleshoot further. Otherwise, is anyone else having CS6 script issues?

Also, got a neat request from user Blair, who wanted a script to do multiple offsets like this:

 It's a great idea for an action, but sadly when you create an action, and select "Path>Offset Path..." from the Object menu, when you run the action, Illustrator stupidly keeps the source object selected, so multiple runs would create extra useless geometry.

I goofed around with the actions pallet, and discovered that when creating your action, if you use the actions fly-out to select "Insert Menu Item", and type in "Offset Path", you'll get a slightly different version of Offset Path with the expected behavior of only having the offset geometry selected, so the action can be run again immediately.

While recording your action, do this:

 When you run your new action, the "Offset" dialog cannot be suppressed  but this can be made negligible by hitting return/enter to close.  If you find that you often need to do lots of custom multi-offsets this might be a good workflow.

If you just want the same type of multiple offset for many objects, you'd be better served manually creating several offset stroke/fill combos in the appearance pallet, and saving it as a style. (which could be expanded later if you needed the geometry.)  If this sounds confusing, Google "create custom styles in illustrator". It's one of Illustrator's killer features.

 Thanks for the inspiration, and happy illustrating.


Wednesday, August 08, 2012

Update to Vary Hues

Minor update. Vary Hues will now create color variations on compound objects, and on objects in groups. Soon, I'll add some controls to give you better control.

  Sorry about not posting more, I've been busy writing a circular calendar widget for Android OS...

Sunday, April 15, 2012

Hey All!
Yes, I know... You like using my scripts, but you get a new computer with a fresh install of Illustrator, and you loathe having to download all my scripts individually. Have I got news for you...

I've finally joined the 21st century and created a GitHub repository for all my scripts. If you've never used GitHub, don't worry, all you need to know is that now you can download ALL of my public scripts in one handy zip file. Get them ALL here.

If you customize any of my scripts and think the modified version would be helpful for someone else, please feel free to fork the code.  I believe strongly in the community of JS4AI developers, and have been a little surprised at how that the playing field has been so sparse for so long.  I know there are a lot of awesome JS developers out there, so hopefully GitHub will provide a connection point to facilitate more co-development for the benefit illustrator community.  Let me know if you have any custom scripts that you want to add. Otherwise, get to downloading, and as always, happy illustrating!!!

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