../JS4AI//template.html wundes.com - Javascript-4-AI
John's Scripts for Illustrator
The following is a small collection of Javascripts for Illustrator 10 and later.
Install them by saving them in your "C:\Program Files\Adobe\Illustrator CS\Presets\Scripts" or equivalent folder.
These scripts should  run on both Windows and Mac platforms. If you have problems, please let me know.
(my email address is in each script)
----------------------------------------
You can access my home page here.
For in depth explanations of scripts, scripting tricks and previews of what is coming soon, you can also check out: Johns Scripting Blog

 Bookmark This Page: Add to Favorites Add to del.icio.us Add to Digg Add to Reddit Add to Furl Add to StumbleUpon Add to Facebook Add to Technorati Add to Google Add to Netscape Add to Spurl Add to Slashdot



=============================================

Script index:
  • arcTwister.js
  • divideTextFrame.js
  • copyToObject.js
  • SelectReplicatedText.js
  • delete_fluff.js
  • joinTextFrames.js
  • swapObjects.js
  • explore.js
  • fleurify.js
  • CMYKtoPMS.js
  • saveWithTimestamp.js
  • alignTextFieldCenter.js
  • ZoomAndCenterSelection.js
  • vary_hues.js
  • textTweaker.js
  • tileWrapper.js
  • sharpenCorners.js
  • Organify.js
  • groupOverlappingObjects.js
  • scallopTemplate.js
  • copyToMultipleObjects.js
  • AddSwatchesLightAndShadow.js

  • =============================================

     
      Arc Twister v1.0    (CS, CS2 )
       Last updated: Wed, Jan 16, 2008 at 20:43:04
        
         This script will twist an objects selected control handles
         by the same amounts.
        
         Current tweakable options are:
         1) Left handles only
         2) Right handles only
         3) Mirror Angles (i.e.; rotates left handle x deg, right handle -x deg.)
         4) Rotate Angles (Fixed relative to each other)
         5) Change angles to Smooth (180 deg) and rotate.
        
         Please Note:
         I designed this script to be the engine behind my ArcTwister Flash Panel Interface.
         This script should work in all versions of Illustrator that support scripting,
         but the panel interface only works with CS3. The panel is much more intuitive.
        
         The Flash Panel Interface is available for download from my blog.
         If you have CS3, I very much recommend you use that version instead.
        
        

    back to the script index (top of page)
     
    _____________________________
     
      Divide TextFrame v.2    (CS,CS2 )
       Last updated: Wed, Jul , 16:54:32 at 5
         Divides a multiline text field into separate textFrame objects.
         Basically, each line in the selected text object
         becomes it's own textFrame. Vertical Spacing of each new line is based on leading.
        
         This is the opposite of my "Join TextFrames" scripts which
         takes multiple lines and stitchs them back together into the same object.

    back to the script index (top of page)
     
    _____________________________
     
      Copy to Single Object    (10,CS,CS2 )
       Last updated: Wed, Jul 26, 2006 at 20:46:38
        User selects two (or more) objects:
         this script copies the top-most object to the position
         and size of the second object.
        
        Version 2 update: now adjusts stroke based on difference in area.
         This script is mostly made obsolete by "copy to multiple objects"
         This version is kept for primarily for posterity,
         and for use on systems that won't run the "multiple copy" script.
        

    back to the script index (top of page)
     
    _____________________________
     
      Select Replicated (Overlaping) Text Items v.1    (CS,CS2 )
       Last updated: Mon, Feb , 19:41:32 at 4
         This script removes all duplicate overlaping text items from a document.
         The ONLY parameters it checks are top and left coordinates, and text contents.
         Anchor points within one point of each other are considered the same.
         (tolerance can be adjusted by changing the 'tolerance' value.)
        
         The lower duplicate objects are selected for manual removal.
        

    back to the script index (top of page)
     
    _____________________________
     
      Delete Unused Assets (fluff) v.2    (CS, CS2 )
       Last updated: Wed, Aug , 16:33:22 at 2
        Code is loosely based on a VB script from
         Adobe Illustrator Scripting by Ethan Wilde
         -------------------------------------------------------
         This script does the following:
         1) removes unused swatches.
         2) removes unused symbols.
         3) removes ALL styles:
         There is no way to check if a style is applied,
         but this is not critical to me because the styled object
         will not loose it's appearance, and the style can be re-added
         if necessary by just dragging a 'styled' object back to the styles pallate.
        
         This script does NOT do the following:
         1) remove brushes:
         The Javascript support just isn't there.
        
         As of version 2:
         You can set two variables at the top of the script to
         delete the "NoColor" and/or the "Registration" swatches.
         They are ignored by default.
        
         THIS SCRIPT HAS BEEN RENDERED 99% OBSOLETE
         BY THE "DELETE FLUFF" ACTION

         which can be found in the "default.aia" file (included with illustrator),
         or you can downloaded the action separately
    HERE
        

    back to the script index (top of page)
     
    _____________________________
     
      Join TextFrames v.2.1    (CS,CS2 )
       Last updated: Tue, Jan 29, 2008 at 16:50:12
         When Adobe came out with the new CS text engine,
         the text fields in documents saved in an older format were
         often broken into "sub" fields.
        
         This script is a rudimentary tool to help
         rejoin the broken text fields. It works best on individual lines of horizontal text.
        
         It collects text from any number of selected (non-grouped) textframes
         and aggrigates them into a single text frame.
         the order is based on relative x,y coordinates.
        
         If a selected text anchors vertical coordinate is the same as the next one,
         text areas are assumed to be on the same line.
        
         If a selected text anchors vertical coordinate is different,
         the text areas are assumed to be sequential lines,
        
        
         This script WILL NOT make any attempt to maintain visual integrety of
         character placement. It will only join the fields for easier editing,
         but sometimes, just this little bit is a HUGE time saver.
        
         As of Version 2.0 an option is given to maintain the individual styling of each letter.
         See first lines of the script for details.
        
        
         the sensitivity of what is considered "the same line" can
         be adjusted by setting the "verticalTolerance" variable
         near the top of the script (just below the style arrays).
         but please note, it is assumed that all selected text is on a horizontal plane.
         If you wish to join rotated textfields, you will have to unrotate them first.
        

    back to the script index (top of page)
     
    _____________________________
     
      Swap Objects    (CS )
       Last updated: Thu, Feb , 12:23:44 at 7
        User selects two objects:
         this script swaps position and size of the two objects.
        
        Version 2 update: now adjusts stroke based on difference in area.

    back to the script index (top of page)
     
    _____________________________
     
       The Document Object Model Explorer v.2    (CS )
       Last updated: Wed, Jul , 16:44:14 at 5
        
         Select an object on the page, then run this script.
         It will return a list of everything that object contains.
         You can also manually explore the document object model by entering an object's path.
        
         As of version 2, a "displayErrors" variable has been added.
         Now users can view objects that failed.
         "displayErrors" defaults to true, but can be turned off by
         setting it to "0" in the first line of the script.
        
         Output is also now alphabetized, and is broken into multiple alerts if output is
         longer than the "maxLines" variable.
        
         Prompt can now be used as a javascript command line too.
         If user input returns a value, the value is returned in an alert box.

    back to the script index (top of page)
     
    _____________________________
     
      Fleurify    (CS,CS2,CS3 )
       Last updated: Fri, Dec , 20:44:28 at 7
         Named after the "Fleur de Lis" as in "flower",
         this script is the bastard love child of a Spirograph and the "Punk & Bloat" filter.
        
         Enter a percentage to "fleurify" and the script turns basic geometry into flowery shapes.
         Warning: the fleurified objects paths will self intersect. This shouldn't matter in print media, but
         for cutable shapes you'll have to use the pathfinder palate to break and merge it.
        
         Note: The anchors are never modified, only the control handles,
         so you can always "un-fleurify" an object using my "sharpen corners" script.

    back to the script index (top of page)
     
    _____________________________
     
      CMYK to Pantone v.2    (CS, CS2 )
       Last updated: Wed, Jun 21, 2006 at 02:29:44
         this script compares the color values of a selected CMYK object to
         the imbedded list of PMS Solid colors, and returns the closest match(es)
        
         Matching is based on cumulative (C+M+Y+K) values, so the PMS color with the
         least total color divergence is always chosen.
         If colors are equally divergent, multiple matches will be displayed.
        
         If no object is selected, or if the wrong type of object is selected,
         user is prompted to manually enter CMYK values.
        
         as of V.2 RGB colors are also accepted.

    back to the script index (top of page)
     
    _____________________________
     
      Save file with timestamp v.3    (CS, CS2 )
       Last updated: Wed, Jun 21, 2006 at 02:29:22
        renames the current open file.
        Saves file, closes and re-opens the file with new name.

    back to the script index (top of page)
     
    _____________________________
     
      Align Ungrouped Textfields to Center (Without Shifting Text) v.1    (CS )
       Last updated: Tue, Jun 27, 2006 at 22:53:42
         When a user clicks the "Align" buttons on the Paragraph tab,
         Illustrator shifts the text visually from it's original position.
        
         I wanted to be able to quickly change the paragraph alignment to center
         without having to reposition the text.
        
         Here's the script to do it.
        
         At the top of the code is a list of acceptable variables to substitute if you
         want to adapt the script to always justify to some other alignment than center.

    back to the script index (top of page)
     
    _____________________________
     
      Zoom and Center to Selection v2.    (CS, CS2 )
       Last updated: Wed, Aug , 13:37:22 at 2
        
         Zooms active view to selected object(s).
        
         New in v.2:
         If nothing is selected; sets view to 100% at current location.
        
         Simple but REALLY cool!
        

    back to the script index (top of page)
     
    _____________________________
     
      Vary Hues / Randomize Colors    (CS, CS2 )
       Last updated: Thu, Jul 27, 2006 at 14:48:04
         This script is designed to create color variations such as seen in brick walls, or stone walkways.
        
         When one or more objects are selected,
         the script provides a prompt to the user with the following three options:
        
         To vary the object(s) fill colors, enter a number from 0 to 100. 100 is maximum.
         To vary the object(s) strokes, add an 's' after the number like this: 42s
        
         The last option is slightly different, instead of entering a number for the variance,
         the user enters an opacity range.
         To vary the object(s) transparencies enter two comma separated numbers
         representing the minimum and maximum like this: 23,44
        
         Since the color values of spot colors by definition cannot be adjusted, the tint is randomized instead.
         Gradients and Patterns are not affected.
         Grouped, masked, or symbol objects are generally ignored.

    back to the script index (top of page)
     
    _____________________________
     
      Text Tweaker v2.0    (CS, CS2 )
       Last updated: Wed, Dec 12, 2007 at 20:12:12
        
         This script randomly tweaks each letter in all selected text fields.
         Text lines remain unbroken, and text remains editable.
        
         Current tweakable attributes are:
         1) baselineShift
         2) horizontalScale
         3) verticalScale
         4) rotation
         5) size
         6) strokeWeight
         7) tracking
         8) leading
        
         New in version 1.1
         Select a linear range to scale text smoothly from 10 to 50.
         New in version 2.0
         smoother transitions between states, and basic (bow and spike) envelope shapes.
         random setting is now set between start and end values rather than from 0
         uses cubic easing for all (non random) transforms
        

    back to the script index (top of page)
     
    _____________________________
     
       TileWrapper    (CS )
       Last updated: Wed, Aug 15, 2007 at 15:35:06
        
         This script creates and exports seamless JPG or PNG tiles.
         It's purpose is to help generate quick seamless tiled backgrounds for web pages.
         To use this script: create a crop area,
         ( Object>Crop Area>Make )
         and draw some objects within it.
         IMPORTANT: Overlap objects to the BOTTOM and the RIGHT side of the crop area only.
         Objects that extend beyond the top or the left of the crop area will be ignored.
        
         To create a tile:
         select all items in the crop area, and run the script.
         This will copy all objects that overlap the bottom and right crop
         areas to the opposite side of the crop area, creating a perfect tile.
        
         To Export as JPG:
         Re-run the script with nothing selected. The script will ask for a destination.
         Export options are JPG or PNG.
        
         Notes: Objects are copied to the bottom of the same layer as it's source object.
         This is so the user can create multiple tiles on other layers without problems.
        
        

    back to the script index (top of page)
     
    _____________________________
     
       Sharpen Corners    (CS,CS2 )
       Last updated: Tue, Nov 27, 2007 at 18:20:36
        
         Removes control handles from selected path points.
         Works same as clicking a point with the convert anchor point tool,
         but enmass on all selected points.
        
         An option is provided for zeroing the control handles of adjacent points.
        
        

    back to the script index (top of page)
     
    _____________________________
     
      Organify 2.0    (CS, CS2 )
       Last updated: Wed, Nov 28, 2007 at 16:31:44
        Randomizes all selected anchors by a selected number of points.
        
         Enter small numbers to make objects look hand drawn.
         Enter larger numbers to make objects look organic.
         Enter even larger numbers to distort beyond recognition.
        
         V.2 now offers a choice for randomizing 'Anchors Only', 'Control Handles Only' or both.
         (click here to view sample image.)

    back to the script index (top of page)
     
    _____________________________
     
      Group Overlapping (Beta)    (CS, CS2, CS3 )
       Last updated: Fri, Apr 18, 2008 at 21:34:22
        
         Groups all overlapping objects in selection into discreet groups.
         The definition for 'overlaping' is based on objects bounding boxes, not their actual geometry.
         Each new groups zOrder is determined by the depth of the front-most object in each group.
         There is no limit to the number of groups created.
         Any non-overlapping objects are ignored.
        
         Note: Currently, this is not very efficient code. It works well on small groups (less than 120 objects)
         and works faster on smaller groupings. Running this on a huge number of objects will likely crash illustrator.
         It serves my purposes, but test it's limits on your machine, and use at your own risk.
         On a 2.53GHz P4, a group of 100 objects took 20 seconds with 2 groups.
        
        

    back to the script index (top of page)
     
    _____________________________
     
      Create Scallop Template    (CS, CS2 )
       Last updated: Wed, Jun 21, 2006 at 02:29:24
        Run script on selected object, then select both the object and the new scallop template
        then use Illustrators "subtract from shape area" transform to cut out the scallop.
         Works on all shapes, and even on sub-selected points of an object.
        
        currently version only works on single non-compound objects.

    back to the script index (top of page)
     
    _____________________________
     
      Copy to Object(s) v4    (CS,CS2 )
       Last updated: Thu, Feb , 18:26:58 at 7
         User selects two (or more) objects:
         This script copies the top most object to the position and size of
         all other selected objects.
        
        Version 2 update: now adjusts stroke based on difference in area.
        Version 3 update: now accepts multiple targets (Thanks Iain)
        Version 4 update: Deselects everything but source object
         --this makes it easy to delete the source object if you wish,
         -- also this makes the older "Replace-Object" script obsolete.

    back to the script index (top of page)
     
    _____________________________
     
      Add Highlight And Shadow Swatches v.1    (CS, CS2 )
       Last updated: Wed, Jun 21, 2006 at 02:29:38
         A simple script for Animators. Takes current fill color from color pallate.
         a prompt will ask you to name the color, then it adds it to the swatch palate,
         along with the highlight and shadow for that color.
        
         feel free to tweak the values to get whatever percentages work best for you.
        

    back to the script index (top of page)
     
    _____________________________
    all files above (c) wundes.com unless otherwise noted.

    More Scripts by other folks can be found in the links section of my JS4AI blog.

    \