Wednesday, May 27, 2009

New Version of Arc Twister

ArcTwister is reborn... Same functionality, but new interface. Now you don't need to install a separate SWF, and the dialog is better than v.1. New dialog looks like this:


And, like the swf version, the object(s) are adjusted each time you release a slider... Slick huh?

enjoy,
-J

Sunday, May 24, 2009

New Script "Extrude Faces"


Extrude Faces

Ta Dahhhh! A quick way to extrude selected anchors from a path object.
Just select a handful of sequential anchors with the Direct Selection Arrow (it's keyboard shortcut is "a" if you didn't know...)

When you run this script, it adds an anchor point at the beginning and the end of your point selection. This allows you to drag your selected points as if they were extruded from the pathObject.

This script was really a solution looking for a problem, I just wanted to see if I could do it.
Of course, sometimes these projects turn out to be the most popular...
If you find it useful, let me know. Check it.

cheers,
-J

Tuesday, May 05, 2009

New Script: allPoints

S'poze you have a shape like this, and you want to draw a line from every point to every other point. OK, no problem. Just turn on "snap to points" drop a few lines, and you're done in 10 seconds. But what if you want to do something a little more complex, or something a little MORE complex?
Well if you do, you're going to love my new little script allPoints.

This script draws all connecting lines groups them together. The original object is kept but is not included in the group. It works on any single selected path item, and it's really, really fast . . . even works on stars and objects drawn freehand.

So, enough babble. Get to it kiddies - make me proud.

Tuesday, April 21, 2009

"Size By Luminance" a.k.a. Halftones!!!

Download:SizeByLuminance.jsx

Want to make halftones in illustrator?

You could go the auto trace route, or you could go with a plug-in from Phantasm. The Phantasm plug-in is powerful and gives you great control, so I do recommend using their product, but if you're on a tight budget, you can try my new script which is easy, and free.

First off, if you don't know about the "Mosaic Filter" in Illustrator, read this quick article. The Mosaic Filter is an amazingly under-used feature and it will do most of the heavy lifting for us today. Filter>Create>Object Mosaic

I will review the steps, but the above link is a detailed and well illustrated walk-through of how to turn an embedded image into an "object mosaic". (a pixellated looking collection of path items). You can mess with the settings, but be sure to check "Delete Raster" or at least remove it manually before running my script.




So, first of course you need to find an image. The image I'm using here is iStock_000008518543.jpg from iStockPhoto.com.






Note: You'll get a better result if you "pre-pixellize your image in Photoshop, but if you're just goofing around with this tutorial, you could just skip that step and embed your image directly into illustrator and apply Filter>Create>Object Mosaic.
Be sure to actually embed the image, and not just link to it, or this step won't work.


Now, just ungroup your new Object Mosaic , select all the pieces, and run my "Resize on Luminance" script and decide if you want your image to be against a black or a white background.









(The script doesn't actually add the background, it just reverses the dot sizing, see the images:

This is the result for the image processed for display against a white background.






This is the same image but processed inversely. Not so pretty now, but watch what happens when we drop it onto a black background.





Tada... Magic.. Ok, now you get the process I think, let's move on.






When you hit enter, a progress bar will come up and you can probably go get yourself a cup of coffee. The demo image here was a 20x30 pixel object which contained 600 pixel elements. On my machine, that took a good 25 seconds. If you have a 100x100 pixel mosaic, you're looking at ten thousand objects, which will take the JS engine quite a bit longer to chug through.

Really, that's the end of the tutorial, you can experiment from here. You could convert all the objects to circles using Effect>Convert to Shape>Ellipse,






You could select all the pixels and turn them black (or white if that was your choice)





Since the image data is now based on Size instead of color, you could even run my copyToMultipleObjects script and replace all the pixels with a Symbol.





Pop me an email if you use the script in any cool projects and I'll link to you in my new twitter feed @JS4AI. :)

cheers,
-J

Tuesday, March 24, 2009

FRACTALIZE!!!!

I'm really excited to announce this one. A couple weeks ago, John Kelly contacted me with this cool little script he wrote. He wanted to give something back to the scripting community, so he asked me if I wanted to do anything with it. We played around with the interface a little bit, and for your Illustrating pleasure, we now present a fun new script that will fractalize any single path object.


It uses an LSystems function (which I don't claim to understand), to duplicate the shapes. Check it out, and post here if you use it in anything cool. Cheers,
-J

Tuesday, March 17, 2009

A short review of Keyboard Shortcuts

Instead of using the mouse, I use the keyboard shortcuts Alt+F and then R to open the scripts menu, then I type the first letter of the script I want, and it just runs, no mouse required. If you are using scripts a lot, this is a huge time saver. (Be sure to check that your "CapsLock" key is off, otherwise it won't work.)

That's all there is to it . . . unless there are two scripts with the same name. Then illustrator highlights the first one, and sits stupidly waiting for you to make a decision. You can hit enter to select the currently highlighted script, or you can repeat the letter to highlight the next script in the list and then hit return to select that one, but I find this "choice" moment to be distracting.

I have found two ways to avoid such collisions. The first is to create sub-folders for related scripts; for instance if I put a sub-folder called "wundes" inside my scripts folder, and put my scripts there, then they would not collide with others scripts that began with the same letters. If I wanted to access my "Zoom and Center" script, I would now Type Alt-F, then R, then W for the wundes folder, then Z for "Zoom." This is a good solution, but it adds an extra letter. Sometimes the organization is worth it, but if not, read on...

The second way, (which I learned today by accident, and which inspired me to write this post,) is to rename your scripts and define the seek letter of the script by the letter that follows the "&" symbol.

Simply put, if I change "Zoom and Center" to "Zoom and &Center", The script will now look like this in the list: "Zoom and Center" Note the underline below the "C". Now when you type your shortcut key sequence, "Zoom and Center can be accessed by Alt-F, R,C which would end the collision with any scripts such as "Zombify.js" or "Zoomogrify.js"...

I won't be changing my existing script names to ensure backwards compatibility, but from now on, I will be using this second trick to avoid collisions. I hope you'll find it useful too.
cheers,
-J

Monday, February 23, 2009

Thursday, February 19, 2009

Yet another SelectBySize Update

I got word from Nick that the SelectBySize script was locking up for a complex graphic he was working on. He sent me the artwork, and while the script worked for me, it took over 9 minutes to complete. Bleh!

So I rebuilt the processing engine from scratch, and now it is much faster. There is also now a floating text field that updates as pathItems are processed in real time. This way, it still may take a long time to finish, but at least you have a very rudimentary progress bar to let you know that the system hasn't taken a dump on you. It is much faster now though. Oh, I almost forgot, it also tells you when it's complete, and reports the total processing time. Nice huh? I know... :)

Update, install and enjoy SelectBySize v.3

-J

Wednesday, February 11, 2009

SelectPathsBySize.jsx UPDATE

Updates in V2

  • More Selections: Rebuilt interface to select objects based on Size, Area, Width, or by Height.
  • Exact Same Size: Added "Exact" option to the "less than" and "more than" radio-buttons (Thanks to Nathaniel for that suggestion)
  • Default Selection: If one object is selected, starts threshold at that size. (Also thanks to Nathaniel's input...)
  • Added Tool Tips: If you mouse-over the dialog elements, you now get helpful tooltips. (Now I just need someone to help me translate them into other languages...)

Download and enjoy!


Tuesday, February 10, 2009

Illustrator Always Crashes on Save

OK no, this not a script related post, but it's one that has caused me enough grief to warrant posting here.

Does Illustrator crash on you every time you try to save a document in CS3 or CS4 on windows XP? Fear not, the answer is simple. The answer is here.

In short, if you don't have a print spooler running, Illustrator crashes ... all your work is instantly, and without warning, vaporized.

The sad part is that I've spent months using a half-assed work around where I created a new XP user for whom the files would save fine. (Since it didn't default to the same printer)

I knew there was a simple answer!!! Hope it helps some of you as well!
::Huge sigh of relief::

Monday, February 09, 2009

UPDATE: CopyToMultipleObjects.js Now with more options!

This one goes out to all you Cartography Aficionados,

I've checked out cartoTalk.com today.
(thanks to Hugo for hawking my scripts there.)

I did a vanity search of the forums, and found some of you folks would be a lot more chummy with my Copy To Multiple Objects script if the objects were allowed to keep their original proportions.

Since, I was feeling all warm and fuzzy this afternoon thanks to all the positive feedback on my latest offering, I've updated copyToMultipleObjects.js to now offer the option of NOT resizing when copied.

Enjoy,
-J

Thursday, February 05, 2009

New Script "Select Paths By Size"

I was looking at the "selection" dropdown menu, and noticed that while AI has a "same stroke", and "same fill", it doesn't have a way to select PathItems below a given size.

So I thought, "hey, I can script, this can't be all that hard..."

End result is my first JS4AI for 2009. "Select Paths By Size" simply selects objects smaller (or larger) than a user-supplied threshold of pixels.
(Also note, this is my first script that uses a slider bar.)



I envision it being used to remove small extra bits from a vector-traced image, but I'm sure you can find something cleverer to do with it... Is cleverer a word???
Let me know if you come up with anything cool.



-J

Monday, May 12, 2008

Site works!

Server issue taken care of... Back in business again! :)
-J

Site is down...

My hosting company migrated servers, and my JS4AI pages are down.
(Thanks for the heads up Helder!)

Hopefully the techs can make everything function the way it is, otherwise I'll have a bit of work restringing the spiderwebs.

I'll post again here when the site is back up and running.

-J

Friday, April 18, 2008

New Script: Group Overlapping Objects

GroupOverlappingObjects is a script that analyzes your selection and creates discrete groups for any objects that are touching each other.

I often need a script like this for less than 100 objects so it serves my purposes. It's almost instantaneous on objects less than 20, but I'm a little disappointed with the speed of this one when processing a larger number of objects.

I tried to rebuild the code using bitshifting to keep track of the overlaps, and the test code worked so much faster, but unfortunately it created a buffer overflow on 100 objects, so I'm posting this version, because it's more robust, and it's finished. :) I may re-address this code at a later date, but meanwhile if you're in a pinch to group a lot of objects, give it a shot.

Monday, April 14, 2008

Never Say Die

This morning I got a request from Karl Stanton from Melbourne, asking about "changing the color of an object inside a blend."

Sadly(...maddeningly...frustratingly), as you may know, access of a "plug-in" item is not directly possible using JavaScript. 

Now, I saw the word "plug-in" in his email, and immediately thought "hopeless" and I told him it was not possible.  
Not easily discouraged, Karl wrote back and suggested that it may be possible to access the objects color indirectly using the swatch palate.  He was, however, having trouble getting the object to stay bound to the swatch when the swatch was changed with JS.

I ran a quick test myself and was able to make it work by setting the swatch to a spot color, and then changing the RGB color values inside the spot, i.e.;


var doc = activeDocument;

doc.swatches["MyCustomSpotColorName"].color.spot.color.red=3;


Had Karl given up after my first response, or had I persisted in my belief that it was impossible, we would never have discovered that changing a color inside a plug-in object actually IS possible.  So folks... The moral of the story (or the morrel if you like mushrooms), is "Never Say Die."

And on that front... "Hi everybody..."
...I have a neat 'grouping' script coming soon... I promise...

stay tuned,
-J


Thursday, February 07, 2008

Minor Bug Fixes

Fixed a line in copyToMultipleObjects where the script would crash if the top layer was locked.
also, fixed a line in swapObjects where if a single path item was selected as one of the items, it would fail.
Also, I got word yesterday that there was an error in the ArcTwister Flash Panel script where the swf could not be found on a Mac.
All of these issues have been fixed, and the new versions are on the server. Let me know if you all find anything else.

cheers,
-J


Monday, February 04, 2008

New Script: "Select Replicated Text"

Hi All,
I got request from M. Prabudass of Chennai India asking if I could write something to remove duplicate/overlapping text fields.

Manually testing and removing the dupes would've been a major pain in the butt, so I wrote this to help him out. If you've experienced the same problem, then maybe it can help you too.

Check it out on my scripts page here.

Thursday, January 31, 2008

Flash Panel Installation (issues)

I've been running Organify2 and ArcTwister side by side now for a couple of weeks, and I am loving the added flexibility they offer in my production. 
 
I very much want to transition all my scripts to the new Flash Panel format, but I've run into a few issues along the way.  Personally, I think the panels are well worth the headache,  but I'm afraid the average user may give up early because it's not one-click simple.   I will go over the details here, so you'll know what to expect, and what to do about it.
 
Panel installation is generally as follows. You put the .swf file in your scripts directory, and put the .jsx file anywhere you want, outside of your illustrator folder. (I'll explain why below.) You may then double click on the jsx file to run the flash panel. Now, on to the issues...
 
1) When running a .jsx script outside of the scripts folder, Adobe pops up a warning:
 
You are about to run a script in Adobe Illustrator CS3. You should only run scripts from trusted sources. Do you want to run the script?
I don't understand how the panel is any more of a threat than any of the files in the scripts folder that illustrator DOESN'T warn you about. Illustrator should at least give the user the chance to "OK" the file so the app doesn't pop up a warning dialogue each time the script gets initialized. 
 
2) If this is your first time running the script, then you'll get ANOTHER warning:
 
 Adobe Flash Player has stopped a potentially unsafe operation.

The following local application on your computer or network:
/Application/Adobe Illustrator CS3/Presets.localized/.../FlashPanelInQuestion.swf

is trying to communicate with this internet-enabled location:
<unknown>

To let this application communicate with the internet, click Settings.
You must restart this application after changing your settings.
 
If I were an end user, that would scare the piss out of me. "What does it mean? What is it trying to do? Ack! spyware, virus, Trojan, worm, rootkit oh My!!!"
 
I don't know why this warning comes up, and I don't know what the swf is trying to communicate with that is so scary since flash ITSELF is an "internet enabled" program. Regardless, it brings up the Flash Security Settings Page" in your browser, and you can set the script (or directory) as OK to run.  Now, finally, you should be able to instantiate your flash panel.
 
"So then why not just run the script from the script directory, like you're supposed to?",  you ask...  Well, if you run the file from the script directory, then you can only run a single flash panel at a time. When you try to launch a second panel, you'll get the alert:

Error: FlashPanel is already running

Starting the panels by manually double clicking on the jsx files outside of the illustrator directory bypasses the issue. You'll get the "You are about to run a script" warning, but now you may create as many Flash panels as you like. In fact, you can run multiple copies of the same panel, although I'm at loss right now as to why someone would want to. I know there is a way to run ALL your panels in the same flash meta-panel, but in my experiments, there is no simple way for users to attach individual jsx files.
 
Today I got all excited about automatically launching panels at startup, which works fine for normal .jsx files, if you create a "Startup scripts" folder in your main Adobe Illustrator CS3 directory.  Unfortunately when you do this for a flash panel, the panel is instantiated as a separate window from the main illustrator app, so when you click on your document, the flash panel disappears behind the Illustrator application, rendering it more of a pain than it's worth.  And to further ensure that the panels never get used in this way, as I mentioned above, you cannot put more than one flash panels' .jsx file in the startup scripts folder, otherwise you get the "Error: FlashPanel is already running" warning.
 
If you've made it this far, and you're still interested in using the flash panels, then the worst is over. The last point in this list is just a minor nuance that you will want to know about when using the panels.
 
3) When the panel is focused, Illustrator is NOT.
This is frustrating in that the flash panel does not work like other palates in illustrator. If you click the panel, then the panel has focus. You can use it to manipulate the art in Illustrator, but you cannot use keyboard shortcuts until you return focus to your document. This is most noticeable when you want to undo a transform using Cntl-Z. You can still undo anything done by the flash panel, but not until you return focus to the illustrator app. (by clicking on it) A minor annoyance, but hardly a show stopper.
 
Now you know what I know about installation issues. I will add notes to the "comments" section of this post if I run in to anything new.
 
I'll end on a positive note.
One never knows how ones actions will effect the world, (unless of course they send you emails and tell you.) ... (Hint, hint...)
I've gotten feedback from some people using my scripts in the medical research field.  It is a tremendous inspiration to me that in some small way I am able to contribute my skills towards scientific discovery. Thanks for the positive feedback.
 
as always, happy Illustrating...
-J

Friday, January 25, 2008

Updated: joinTextFrames

I got a letter from India the other day requesting this one.

JoinTextFrames V2.0 now copies formating from the source letters, so superscript text will stay superscript, larger letters, stay large etc...
Also, positional values are now compared from the textFields anchor points rather than from their boundaries, which means superscript will end up where it's supposed to.