Tag cloud script in illustrator. How to install scripts in Adobe Illustrator

Adobe Illustrator has many tools and features to implement any ideas. But even with so many possibilities in its arsenal, something will surely be missed. On the Internet, you can now find many scripts and plugins for Adobe Illustrator, expanding its functionality. Without these additions, Adobe Illustrator may not be able to cope with some tasks, or add extra work for the artist. Therefore, today we will consider a few useful and free scripts for Adobe Illustrator.

Script Installation

In order for the script to work in Adobe Illustrator, we need to place it in the Scripts folder, which is located in the Adobe Illustrator directory. In my case, it is ... / Adobe / Adobe_Illustrator_CS5 / Presets / en_GB / Scripts. If you use an earlier version of the program, instead of Adobe_Illustrator_CS5, in your case there may be Adobe_Illustrator_CS4, Adobe_Illustrator_CS3, etc.
  If you downloaded scripts that are compressed into an archive, then do not forget to unpack them. After installation, you must restart Adobe Illustrator.

Available scripts can be found on the File tab in the Scripts submenu.

Select open path

This script will find and select all shapes with an open path. This script will be useful when creating a vector for microstock, because closed loops is one of the criteria for accepting your work in the microstock database.

Close All Paths / Close All Selected Paths

This script closes the outline for all shapes, or for selected shapes. So, for example, after searching for open circuits using Select Open Path, you can make them closed.

Devide Text Frames

Using this script, you can divide a single text field into smaller ones, with the transition to a new line being the place of separation.

Join Text Frames

This script will combine several text fields into one.

Fleurify

Thanks to this script, the figures will be decorated with beautiful floral curves.

Metaball

After using this script, several simple shapes will turn into more complex ones.

CMYK to Pantone v. 2

This script converts CMYK color mode to Pantone

Circle

Thanks to this script, you can create circle shapes with the required number of points on it.

Remove anchors

This script will delete the selected points on the figure.

Round any corner

After using this script, the sharp corners of the shape will be converted to rounded.

Swap objects

This script will give one object the properties of the second, and the second - the properties of the first. As properties, the size and location on the workspace will be used.

Select Path By Size

The plugin will help you find figures of a certain size.

Usually, when it comes to programs for designers, priority is given to the artistic possibilities of applications - drawing tools, filters, etc. But in everyday life you have to deal with routine. Fortunately, software from Adobe (including Illustrator) began to support the writing of scripts (scripts), allowing you to shift the monotonous work onto the shoulders of the machine. And you no longer work in Illustrator - you manage it, and this, as they say in Odessa, is two big differences!

Realizing that the vast majority of Illustrator users are artists and designers who have not encountered programming, I’ll try to build an overview of scripting functionality so that readers don’t get the impression that this lesson needs some kind of “special” mentality and a long special education. At the same time, I apologize to the professionals for some simplifications in the wording for the sake of the availability of material. The author himself was once in a similar situation and at first did not consider this sphere his diocese. But I spent less than two weeks studying it and now I affirm: having minimal understanding of programming, mastering scripts is a perfectly feasible task.

Scripts for Illustrator can be written in any language: JavaScript, Visual Basic (Windows) and AppleScript (Mac OS). Since the majority of readers are familiar with the first one (many designers for printing successfully cope with the creation of Internet pages in which it is used), we will rely on it. Moreover, JavaScript is platform independent: scripts written on it will work in both OSs - Windows and Mac OS. The way to access the elements is object-oriented: in order to find out, for example, the border thickness of the second vector element on the first layer, you need to write the following construction:

app.activeDocument.Layer.pathItems.strokeWidth

This can be interpreted as follows: first, the object of the highest level in the Illustrator hierarchy is indicated (app is an application short for application), and then the selection is gradually narrowed down to a specific element (in the active document, work on the first layer; then select the second deepest vector in the specified layer object and find out the border thickness). Such a method of accessing elements is very convenient, because it allows you to easily navigate the entire variety of their types that exist in the editor. A complete relationship model can be found in a well-written description (included with Illustartor).

Square brackets indicate that the element is part of the array. An array is a collection of several objects united by a certain attribute. For example, Layers, pathItems, RasterItems, GroupItems, Selection, etc. are arrays consisting of objects of the same type (document layers, vector paths, raster images, groups, etc.). In parentheses indicate the index (serial number) of the required element in the array. So, the Layer entry denotes the first layer, since the first index is always “0”.

Objects can also be accessed by the name Layer [“Chart”]. To do this, the element must be explicitly named - manually, using the Layers palette (double-clicking on the name of the object opens a window with its properties), or from a script. In order not to write a cumbersome construct each time listing all the “pedigree”, use the references:

pI \u003d activeDocument.Layer.pathItems;

Then the above code section will look like: pI.strokeWidth.

It is allowed not to refer to the layer as an object every time if all operations occur on the same active layer. And note that the names of the variables have a case: if you write pI for the first time and pi for the second, then the script will throw an error and will not work.

In an object-oriented model, there are: the application itself, classes (types of objects, or, using a more familiar concept, nouns: layers, vector objects, groups, etc.), methods (ways to interact with them - verbs: move, duplicate and etc.) and properties (adjectives: strokeWidth, fillColor, selected, etc.). To make it easier to navigate, imagine that an application is a house in which there are various objects - an analogue of classes (windows, doors) that have some properties (plastic, wooden) with which they perform certain actions - methods (open, close). Understanding the essence of such a hierarchy, it is much easier to understand scripting.

At the highest level is the application, and, literally following the rule of subordination of objects, it would have to be indicated in any action. In order to simplify, the link to the application can be omitted - except in cases where you really need to know some of its properties (for example, available fonts - app.fonts).

The Layer, Group, Text classes can contain objects of the same class, which can also have children. A useful feature of the object approach is inheritance   properties. So, all vector paths (pathItems) are children of a more general class - page elements (pageItems). Therefore, by assigning certain properties to pageItems, we automatically assign it and pathItems.

Despite their similarity, the Layers and Layer classes are still different. The first is a collection of all layers in the document, the second is just some specific one, and accordingly their methods and properties differ. You can apply the add, removeAll methods to the first, and to the second, all operations available for a separate layer. The object itself is accessed as an element of the corresponding array - in our case, through Layers, Layers, etc.

The selected element corresponds to a separate class - selection, which is also an array (a group of objects can be selected). On a special account in Illustrator are the pluginItems, Colors, Views classes. The first has many limitations associated with the fact that objects of this type are not native to Illustrator. These include the elements Blend, Envelope, Mesh and similar. We will consider the features of the rest as they are used.

In order for the script to be “visible”, it is placed in the Presets.Scripts folder located in the one where the application is installed. We will consider real examples (this will immediately feel the usefulness of the scripts), and write them under Illustrator CS, since its scripting is more flexible than previous versions.

Example 1: combining objects

Let's start with the simplest one - we will write a script connecting lines of subordinate objects to the main one (a frequent task when creating flowcharts, technical documentation, and similar works). And we will touch upon such basic issues as working with selected objects, creating new layers, placing objects, changing their order, creating and including curves in a compound path.

Working with such documents involves the widespread use of symbols (symbols) - making changes to them automatically updates all created copies. However, Illustrator does not always work correctly with such elements: it happens that it does not read the names of objects that are copies of characters. As a result, their selection by name is not feasible. Processing all the elements of this type in the current layer is of no practical use. As a result, I leaned in favor of an alternative option, in which you first need to select the required objects (the easiest way is to select one character and search for its copies through the Select.Same Instances command), and then select the reference element with which they will be connected.

So here we go. To shorten, we introduce the sel variable, which we will refer to when we need to carry out any actions on the selected object. Then we’ll check how many elements are selected (although any selected characters of the text also belong to the selection array, we won’t check if the selected text is not selected). Write if (sel.length<2) означает, что мы сравниваем значение length (количество объектов класса sel) с двойкой — минимальным количеством для работы сценария. Если выделенных элементов меньше, будут выполняться действия, заключённые в первые идущие за оператором if фигурные скобки, иначе — идущие после else. При этом логично предусмотреть выдачу сообщения, чтобы сориентироваться в ситуации и понять, что нужно сделать.

sel \u003d activeDocument.selection
   if (sel.length<2) {br>   alert (“Not enough objects to proceed! \\ nSelect at least 2 objects and the last - target object!”))
   else (

Alert is a standard JavaScript function that displays a window with the specified text and the OK button. "\\ N" means go to a new line and is used to keep the window small. The text displayed in the window must be enclosed in quotation marks.

Preparatory stage

Get the coordinates of the center of the reference object. Since we agreed that he is the highest, his number (index) is “0” (sel). To calculate the coordinates, we will use such properties of the object as position (position), width and height (height and width). The position values \u200b\u200bare stored in an array consisting of a pair of values \u200b\u200b- the coordinates along the X and Y axis, respectively. Therefore, everyone needs to be addressed as position and position.

refObj_x \u003d sel.position + (sel.width / 2);
   refObj_y \u003d sel.position - (sel.height / 2);

We got the coordinates of the center of the reference object and assigned them to two variables for further use. The second line contains a “-" sign, because Illustrator accepts the lower left corner of the document as the reference point, and position gives the coordinates of the upper left corner of the element.

Since convenience plays an important role when working with a document, we will make sure that the lines created are on a separate layer - such structuredness will help maintain order in a layout of varying complexity.

Create a new layer - it, like any Illustrator element, is created by the add () method applied to the corresponding class of objects. In parentheses, you can specify the parameters of the action: specify the destination object (it can be, for example, a layer or even a new document, as well as the position at the destination). Unlike most methods, no additional parameters are provided for add, therefore, to transfer to the highest level, we will use a special method - zOrder, which we will specify BRINGTOFRONT as a parameter (a reserved constant, a full list of which is given in the documentation). In principle, if the document has only one layer, it is not necessary to specifically indicate the position of the new one, since Illustrator always places it above the current one. If the objects to be connected are not located at the highest level, the second line will be needed.

newlayer \u003d activeDocument.layers.add ();
   newlayer.ZOrder (ZOrderMethod.BRINGTOFRONT);

The first line can be read like this: create a new element by increasing (add) the number of objects of the required type (layers) and assign a link to the newly created element to the newlayer variable. At the initial moment, the layer is empty, because nothing has been placed in it yet. To simplify orientation in a complex layout, give the layer a name “Connectors” (by the name method) - as you can see, the names of the methods clearly indicate the actions performed.

newlayer.name \u003d “Connectors”;

For educational purposes, we will create not separate lines, but combined into an object of the Compound Path type for ease of editing. Creating such an object repeats the already known procedure, this time applied to the compoundPathItems class:

newCompoundPath \u003d activeDocument.compoundPathItems.add ();

Since in the last step we created a new layer, it is active - accordingly, the created objects will be located on it, and there is no need to specifically indicate it (activeDocument.newlayer).

Determining the coordinates of subordinate elements

We combine this process with the output of the connecting lines themselves, since their number should correspond to the number of objects. In turn, we begin to sort through all the selected elements (“i ++” means incrementing by one) and read their coordinates. We will start the search not from the very first object from the Selection array (as you remember, the reference object acts as it), but from the second (sel). The following lines are already familiar to us:

for (i \u003d 1; i< sel.length; i++) {
   obj_x \u003d sel [i] .position + sel [i] .width
   obj_y \u003d sel [i] .position - sel [i] .height

Having received the coordinates of the center of the child, we proceed to create a line connecting it with the reference. For each selected element, create a new object - a vector path included in the CompoundPath class, increasing the total number of paths:

newPath \u003d newCompoundPath.pathItems.add ();

To set simple contours in Illustrator, there is a setEntirePath method, the parameters of which are an array of coordinates of the start and end points - which, as we already know, are in turn specified as arrays of two values \u200b\u200b(positions along two axes). Finally, we finish the condition “if something is highlighted” introduced at the very beginning.

newPath.setEntirePath (Array (Array (refObj_x, refObj_y), Array (obj_x, obj_y))); )

The script is ready. As you can see, there is nothing complicated in it: the names of the methods reveal their essence, and the object-oriented model helps to clearly understand the hierarchy of Illustrator objects. The script does not have any special practical value (it is more likely to be teaching), but on its example many basic concepts were considered, which we will rely on in the future (work with selected objects, the principle of their numbering in the selection array, determining coordinates, creating new layers, output lines).

Example 2: detecting too thin contours

Scaling operations in vector graphics are very active. Therefore, when reducing the size of objects with thin lines (if the Scale strokes parameter is enabled), often the thickness of their stroke becomes lower than 0.25 pt (the value after which the lines become poorly visible) and it causes them to disappear when printed on an inkjet printer. Illustrator’s built-in search functions for objects with stroke values \u200b\u200bless than the specified value are not provided. Manually finding them is very difficult - you have to select each object individually, which quickly discourages the desire to engage in such checks. The script will greatly simplify the operation.

The script itself in the simplest version is small, but we will set a goal to make it more universal - we will expand the functionality due to the ability to specify the minimum thickness in the dialog box. Of course, you can rigidly register this value in the script itself and, if necessary, adjust it each time, but, you see, this is inconvenient. We also provide an indication of the selected element as a reference object with the minimum acceptable border value. In parallel, for statistics, we calculate the number of elements with a changed thickness and select them for clarity.

The entire script is divided into two parts: the initial (reading the value from the dialog box or the selected item) and the final (searching among all objects in the document and reassigning the border thickness). In addition to demonstrating access to Illustrator objects, we will consider creating a mini-interface for entering custom values.

Entering Values

The first two lines will be identical to the previous example, except that instead of “2” “0” will appear, because before the script we need to determine if there are any selected objects. Comparison is given by a double equal sign (unit assigns a value).

var mySel \u003d app.activeDocument.selection;
   var go \u003d true;
   if (sel \u003d\u003d 0) (

If nothing is selected, the minimum thickness will be set through the dialog box. We derive it using the standard JavaScript function - prompt. It opens a window with a field in which you can enter a value and use it later. The syntax of the function is as follows: first there is a hint text that will be displayed in the window (taking into account the unification of the script, we will not use the Cyrillic alphabet, because it is often displayed incorrectly), then the value that will default to the input field follows. There are two pluses: the ability to immediately set the minimum allowable thickness and specify any value. By creating a variable that is assigned the value of the prompt function, you can then use it for your own purposes.

Looking ahead, I note that Illustrator does not provide full access to all types of objects - some are left overboard. Therefore, we will provide visualization of not only fixed elements, but also inaccessible to the script, so as not to look for them manually - because they can also contain problem objects. In order not to display two dialog boxes (for the thickness value and determining which elements to select), we will use JavaScript's string processing capabilities. The fact is that the contents of a user-filled field is a “string” (a block of information), which can contain any number of parameters (through delimiters). Knowing the separator, the values \u200b\u200bof individual parameters can be easily extracted from the string.

Accordingly, the text prompting the dialog box will be as follows: setting the minimum border thickness and a conditional number: “1”, if you want the script to highlight the corrected elements, “2” - those to which you could not “reach out”.

value \u003d prompt (“Specify the stroke width threshold (in pt), \\ n What to select: corrected objects (1) or inaccessible (2)”, “0.25, 1”)

Initially, set the field to 0.25 points (units of measure in Illustrator by default), but when changing it, the new value will be used, and “1”. "2" should be specified only if the script finds inaccessible objects (we will make sure that it signals this at the end of the work). And they will become highlighted, which will save us from manual search (as you know, the built-in Illustrator search leaves much to be desired).

Having read the values \u200b\u200bfrom the user field, we figured out, we proceed to their processing. Check if the field is really non-empty (the “!” Sign denotes negation, that is, “! \u003d” Is equivalent to “not equal”, null is the registered word for an empty value). If there is something in it, we break the string into separate blocks using the JavaScript split function (we will define the combination of characters “,” as a separator) and put the resulting values \u200b\u200binto the splitString array. After that, we will give descriptive names to the values \u200b\u200bfrom the array (the first will determine the thickness, the second - the operation mode).

if (value! \u003d null) (
   splitString \u003d value.split (“,“);
   weight \u003d splitString;
   type \u003d splitString; )

If there is nothing in the user field, we stop the script. The last closing bracket is a sign of the completion of the condition that we set at the beginning (“if nothing is highlighted in the document”).

else (go \u003d false)

If the reference object is specially selected

Now we’ll write a sequence of actions if we intentionally selected an element whose border thickness we want to use as a threshold value. We will display a warning about further actions of the script using the standard confirm function (creates a dialog box with two buttons - and). If you click<Сancel>, work stops, if you agree, the script will continue to work.

else (selectedMsg \u003d confirm (“Stroke width of selected object will be used as threshold”)
   if (selectedMsg! \u003d true) (
   go \u003d false;
   ) else (

We pass to the main part of the script. We do not consciously consider the situation when several objects are highlighted, because for setting the border thickness it’s enough to select only one. And what value should I use if it turns out to be different for the elements? As we already know, the only selected object will have an index of "0", and to get the edging thickness, Illustrator has a strokeWidth property. We will take into account that, in principle, selection can contain not only individual elements, but also part of the text (for example, selected by chance), which is not included in our plans, so before starting work, check the JavaScript capabilities to select the type of the selected element that belongs to an array:

if (sel isArray) (
   weight \u003d sel.strokeWidth;

Since we agreed to select only the changed objects, we need to remove the selection from the most reference one (refer to its selected property):

sel.selected \u003d false; )))

Now we are fully prepared to perform the main task of the script - search for objects: the value that will be used as the minimum allowable thickness is stored in the wei variable.

Circumstances

Compare it with a similar property for all objects in the document. You can immediately proceed to the search, but the use of the script in daily work required taking into account additional circumstances - in layouts there are often both locked layers and individual objects. Therefore, even though the search works in them, you cannot make changes. To ensure total verification, we add several operations to the script: checking the elements for compliance with the specified criterion, at the same time unlock them, if necessary, and remember the index so that after the verification is complete, return them to their previous state. We introduce two variables: the first for reduced access to all layers in the document, and with the second we get access only to the locked ones. We will store the serial numbers of the latter in an array, which we create with the JavaScript function - new Array ().

var dL \u003d activeDocument.layers;
   var blokedLayers \u003d new Array ();

Then we’ll look at all the layers and for the locked ones (property locked \u003d true) we will place the sequence number in the blokedLayers array (using the push function from JavaScript), after which we will allow their editing (locked \u003d false).

if (go \u003d\u003d true) (
   for (i \u003d 0; i if (dL [i] .locked \u003d\u003d true) (
   blokedLayers.push (i);
   dL [i] .locked \u003d false; Previously, we agreed to highlight fixed objects, but after the script finishes working on locked layers, we won’t be able to do this - we need to display an appropriate warning. To do this, use the lockedPresence attribute, which will be set if at least one layer is locked.

lockedPresence \u003d true;

We will repeat the same with individual locked elements. In the simplest case, it is enough to check all the vector elements (class pathItems), which include compound pathes as a subclass - so that nothing escapes the script's all-seeing eye.

Underwater rocks

In addition to the considered situation with blocking, there is another “pitfall”. As already noted, some elements (in particular, the Blend Group and Envelope) are not "native" to Illustrator, they belong to a special type pluginItem. At the same time, Illustrator does not provide access to such objects, they are a “thing in itself”. You can “reach out” to them only through a class of a higher level - pageItems, through which we can at least determine their presence and display a warning at the end. It will say that by running the script again and specifying “2” as the second parameter in the input field, it will highlight these “black boxes”.

pgI \u003d activeDocument.pageItems;

To store the indexes of blocked objects, create an array called blokedPathes, and to calculate the number of changed objects, we introduce the variable corrected.

bloсkedPathes \u003d new Array ();
   corrected \u003d 0;

For all objects, we will check for belonging to the PluginItem type (typename property): if there are any, set the pluginItemExist flag (its state will determine the warning output about the presence of such elements). In the case of a repeated check (when the second parameter in the input field is "2") we will select them:

for (i \u003d 0; i< pgI.length; i++) {
   if (pgI [i] .typename \u003d\u003d “PluginItem”) (
   pluginItemExist \u003d true
   if (type \u003d\u003d “2”) (pgI [i] .selected \u003d true)

So, all (or almost all) possible situations that arise in the work, we have foreseen and identified actions for them.

Basic check

Now the turn has come to actually check the layout for compliance with the specified fringing criteria. We take into account that among the objects there may also be those for which there is no edging at all (determined by the state of the stroked attribute) - therefore, they must be excluded from the scan.

if ((pgI [i] .strokeWidth< weight)&&(pgI[i].stroked)) {
   if (pgI [i] .locked \u003d\u003d true) (
   blokedPathes.push (i);
   pgI [i] .locked \u003d false;

This code fragment can be interpreted as follows: we determine the presence of a border and its thickness for each element. If it is less than the minimum (if (pI [i] .strokeWidth< weight), и объект заблокирован, его индекс занести в специально созданный для такой цели массив blokedPathes, после чего разблокировать для внесения возможных изменений. Знак && обозначает логическое «И» (обязательное совпадение двух условий) — толщины меньше минимальной и присутствия окантовки.

Then we fix the presence of locked objects (we set the lockedPresence flag to display a warning in the future that not all changed ones can be highlighted) and select the corrected one, and assign a threshold value to its border - and so on for all elements. For statistics, we will simultaneously calculate the number of changed objects.

lockedPresence \u003d true;
   pgI [i] .selected \u003d true;
   pgI [i] .strokeWidth \u003d weight;
   corrected ++;

The steps to highlight unverified elements (type \u003d "2") were previously considered. Now we define what should happen in the standard situation - with the usual search for potentially problematic objects.

if (type \u003d “1”) (pgI [i] .selected \u003d true)

Restore blocked items status

We completed the main task - the problematic objects were fixed and highlighted. It remains to restore the status quo - all initially blocked to return to its previous state. To do this, in the current cycle we read the contents of the array, where the indices of the blocked objects are stored, and set the attribute locked \u003d true for each corresponding element (the shift method displays the last value entered into the array from the array). Since the total number of objects is more than blocked, care must be taken to complete the scan cycle after emptying the array.

if (blokedPathes.length\u003e 0) (
   retrievedPathes \u003d blokedPathes.shift ();
   pI.locked \u003d true;))

Then we will take similar actions with respect to the layers:

for (i \u003d 0; i if (blokedLayers.length\u003e 0) (
   retrieved \u003d blokedLayers.shift ();
   dL.locked \u003d true; ))) In fact, for similar operations it is much more convenient to use functions. Their advantage is that once you describe certain actions, you can repeat them in full, simply by calling the function in the right places; in this way the compactness and readability of the script is achieved. To increase the flexibility of the function, the values \u200b\u200b(parameters) used in it are passed. If you do not want to use the functions, skip the next two paragraphs.

Let's make two functions: the first - to unlock layers and objects, the second - to restore their attributes. Only object types (the Layers and pageItems class) and arrays for recording the elements of interest to us (blokedLayers and blokedPathes) will change in them - they will appear as function parameters. We write the first one like this:

function unlock (array, itemType)
   if (itemType [i] .locked \u003d\u003d true) (
   array.push (i);
   itemType [i] .locked \u003d false;
   locked \u003d false;
}

Instead of array we will substitute an array, instead of itemType - the necessary class. Then we get two calls - unlock (blockedLayers, dL) and unlock (blokedPathes, pgI). Similarly, we write a function to restore status:

function restore (array, itemType)
   if (array.length\u003e 0) (
   retrieved \u003d array.shift ();
   itemType.locked \u003d true;
}

Display information about the results of verification

This is the last stage of the script. First, we define the condition for displaying the message if the search for non-editable objects is selected, then the condition for the warning that such objects were detected:

if (type \u003d\u003d “2”) (b \u003d “\\ nCheck selected!”)
   if (pluginItemExist \u003d\u003d true) (
   alert (“Due to scripting restrictions some objects can" t be affected ”+ b))

The logic of issuing a warning that not all corrected ones can be highlighted is as follows:

if ((lockedPresence \u003d\u003d true) && (pluginItemExist \u003d\u003d false)) (
   warning \u003d “\\ nBecause some of them are locked they can" t be showed as selected ”)

Then we derive the final results:

alert (“Number of corrected objects are:“ + corrected + warning)

Here, in fact, is the whole script. As you can see, these few lines do a tremendous amount of work, which hardly anyone would dare to do manually. The script is executed instantly (in large-scale projects, with the number of elements on the order of several thousand, processor performance begins to affect). You only need to select it from the list of available ones (you can even not do this - Illustrator allows scripts to assign “hot keys”) with the Edit.Keyboard shortcuts.Menu commands.Scripts command. But note: the names of scripts are sorted alphabetically, so adding new ones or deleting old ones can lead to reassigning keys to neighboring scripts. Conclusion: after changes to the Presets \\ Scripts folder, check the correspondence of the keys.

We tried to make the script universal, which affected its volume. In the most primitive version (without taking into account the features and pitfalls described above) it takes literally a couple of lines:

minWidth \u003d activeDocument.selection.strokeWidth;
   pI \u003d activeDocument.pathItems;
   for (i \u003d 0; i< pI.length; i++) {
   if ((pI [i] .strokeWidth< minWidth) && (pI[i].stroked)) {
   pI [i] .strokeWidth \u003d minWidth;
}}

What about dessert?

We will devote the next issue to business cards: we will write a script that automates their layout on a sheet. However, it is useful for a wider range of tasks, since it does not have a reference to the size of objects. As expected, we will provide for the creation of issues to avoid problems with inaccurate cutting of the sheet, as well as the rotation of business cards (if their top and bottom are significantly different). At the same time, we will touch upon the issue of searching for objects whose color model differs from the given one, which is also not uncommon during similar works.

Magazines are freely available.

On the same topic:

    News 2019-04-03

    How extra white ink helps create new applications for large format printing.

    Today, a number of models of large-format and ultra-wide format printers can print in ink of an additional color - white, which creates new possibilities for using these devices. But printers can implement various technologies for printing with white ink, and different technologies have their own capabilities and limitations.

The functionality of Adobe Illustrator is huge, but there are also some drawbacks, the benefit of this program is scripting, which simplifies and even extends the ability of the program. In addition to scripting, there are extensions — custom panels for expanding the program, but that’s a slightly different topic.

Script Installation

If you've never used scripts in Adobe Illustrator, here's a quick guide on how to run a script.

First we need to put the scripts that you want to use in the "Scripts" folder. How to find the path to this folder? It's simple, we go to the root of the folder where the program Adobe Illustrator itself is located, then "Presets -\u003e en_US -\u003e Scripts", instead of en_US there may be another folder with localization, what kind of localization Illustrator has, choose such a folder.

After you placed the scripts in the folder, you can run them using the standard method - this is launched through "File -\u003e Scripts", the list of your scripts will be in the drop-down menu, click on any of them and you will run the script. Even if your scripts are in a different folder, you can also run them, and in several ways:

  1. Go to the menu "File -\u003e Scripts -\u003e Other Script ...", the explorer will open, after which you need to find the script file, and then run the script
  2. You can simply drag and drop the script from Explorer to Illustrator, after which the script will launch
  3. You can use extensions to run scripts - this is the panel for Illustrator, which allows you to run scripts directly from the program. There are several such extensions. I recommend using LAScripts.

Harmonizer

Script for arranging elements on a grid

Select the objects, run the script, select the number of columns (the lines will be calculated automatically), select the distance between the elements, as well as their centering (by default, the largest element is selected).

ArtboardsResizeWithObjects

A script for resizing an artboard along with content.

In Adobe Photoshop there is a function "Image size" to change the artboard along with the contents, but in Adobe Illustrator there is no such function, out of the box. Sometimes, it may be necessary to change the artboard along with the contents, so that after the change all the states are preserved.

Suppose you decide to change the artboard with your hands, the order of your actions: Change the artboard, then you select all the elements on the artboard and change the size, but just one problem pops up here. If you have elements with a stroke, then when changing by hand, the stroke will not decrease along with the reduction of the object, but you can get around this by checking the box “Scale strokes and effects,” but what if you need to resize several artboards? To simplify and save time, use the artboardsResizeWithObjects.jsx script


  • New scale factor   - scale of the artboard as a percentage
  • New artboard width   - new width of the artboard, the height will change proportionally
  • New artboard height   - new height of the artboard, the width will change proportionally
  • Only active artboard   - change only the active artboard
  • All artboards   - change all artboards
  • Custom artboards   - change arbitrary artboards, you can write either as a comma or as a hyphen (as when you specify pages when printing)
  • Include hidden & locked items   - take into account locked and hidden elements
  • Input field for size   - By default, the width of the active artboard is taken.

ArtboardsRotateWithObjects

A script to rotate the artboard along with the contents.

In Adobe Photoshop, you can rotate the artboard and the content will also be rotated, but in Adobe Illustrator there is no such function from the box.

This script will be useful if you need to rotate several artboards, or if you do not want to waste time adjusting the position relative to the artboard after it is rotated.


A brief description of each of the items in the script:

  • Active artboard #   - rotate only the active artboard
  • All artboards   - rotate all artboards
  • Rotation angle 90 CW   - turn the mounting area clockwise
  • Rotation angle 90 CCW   - turn the mounting area counterclockwise

InlineSVGToAI

A script to insert svg (and convert svg code) into a document.

In the version of Adobe Illustrator CC 2018 v.22.1 (March, 2018), the ability to insert an svg object was added, the script in this case does not need to be used.

I was always annoyed that svg cannot be pasted into a program that specializes in vector, I mean, if we copied svg code from an editor or from somewhere else, but in the form of text, we won’t be able to paste it into a program. You will need to first save the code in a file, only after that open the file in Illustraor, copy the contents and paste into the desired document. A lot of unnecessary actions, is not it?

To get rid of this misunderstanding, I wrote a script that will automatically create a file, import the contents into your document, and then delete it. Those. the script does the same thing, but only without our participation and there is no need to spend time on it.


A brief description of each of the items in the script:

  • It's simple - paste the contents into the field and click "Paste"

Puzzle clipper


Script to create puzzles based on objects.

The script creates groups with clipping masks, the element that will be "sawn" is the lowest object of the selected ones. Operating modes, if you have a group on top and an object on the bottom, then all the elements in the group will be converted into groups with a clipping mask and an object from the very bottom of the selected ones. The script does not have an interface, just select the elements you need and run the script.


ReplaceItems

A script for replacing objects with the original, objects from a group or from the clipboard.

For example, you need to replace some elements on the layout, but replace them with your hands for a long time, you can use this script to replace it, just select the element you need, copy it, then run the script, select "Object Buffer".

Also, the script can accidentally rotate each of the elements, take the size of the replaced element, take a fill, and you can also not delete the original element.


A brief description of each of the items in the script:

  • Object in buffer - the object is on the clipboard
  • Top object - the object is the first from the list of selected
  • All in group (random) - randomly selects an object from the group
  • Scale field - scale of the inserted element
  • Replace items in a group? - Are the replaced items in the group? (if the elements that need to be replaced are in the group, check this box, otherwise the whole group will be replaced, and not every element from the group)
  • Copy Width & Height - Copy the Width and Height values \u200b\u200bfrom the replaced element
  • Save original element - save (do not delete) replaced element
  • Copy colors from element - copy the fill from the replaced element
  • Random element rotation - randomly rotate each element

CreateArtboardsFromTheSelection

A script for creating artboards based on selected elements.

The script creates an artboard based on the selected elements, as well as for each of the selected.


A brief description of each of the items in the script:

  • Each in the selection - create for each of the collection of selected items
  • Only selection bounds - create an artboard based on a selection.
  • Item bounds Vsible - Visible item borders
  • Item bounds Geometric - the borders of the geometric element

Transferswatches

A script to import color swatches from a document into an active document.

Run the script, select a document from the list, you can also check the box so that colors with the same name are replaced.


ArtboardItemsMoveToNewLayer

A script that puts the contents of the artboard onto a new layer.

Run the script, select the artboards, you can also select "delete empty layers and sublayers", and "Layer name from artboard name".


Adobe Illustrator has many tools and features, but there will always be something missing for an advanced user. Therefore, developers create scripts and plugins that will help solve a variety of tasks and speed up labor-intensive processes. Today we have prepared for you an overview of the best free scripts for Illustrator. Their list is systematized and divided into several groups according to functionality. This work with paths and points, various types of distribution of forms, generating objects, working with the Layers panel, text objects, color, etc.

Install and run scripts

You need to install the script in the following folders:

For Windows: C: \\ Program Files \\ Adobe \\ Adobe Illustrator CC 2014 \\ Presets \\ en_GB \\ Scripts

For Mac OS: Applications / Adobe \\ Adobe Illustrator CC 2014 \\ Presets \\ en_GB \\ Scripts

To run the script, go to File\u003e Scripts\u003e ...

You can also place scripts in any other convenient place on your hard drive. In this case, to run the script, go to File\u003e Scripts\u003e Other Script ... (Cmd / Ctrl + F12).

If you often use scripts, then for a convenient start you will come in handy. This free plugin gives you access to the script from the panel, which can always be placed in a convenient place.

Now let's look at the list of scripts, which are divided by functionality:

Scripts for working with paths, points and handles

This script rotates the handles of control points, changing their length equally. After running the script, you have the opportunity to choose one of five types of handles, then set the parameters for lengths and angles.

This script creates flowers from ordinary shapes. Great for creating interesting patterns, logos, etc.

The script removes overlapping points and reports how many were deleted.

The script closes open paths in the current document. Does not connect touching paths.

The script changes the direction of the selected paths in accordance with the direction of the upper segment. That is, after applying the script, all selected paths will have one direction.

The script copies the topmost object at the position and sizes of other objects. It’s hard to describe, it’s easier to look at the picture below.

Scripts Distributing Objects

The script fills the form with circles.

The script places objects at the same distance along the selected path. You can redistribute objects that are in one or more groups.

The script duplicates the top object and places the copies at the selected points.

The script rotates the objects to the center of the upper object.

The script rotates all objects to the position of the top object.

The script makes it possible to divide the area of \u200b\u200ba vector object in accordance with data that can be represented in absolute or percentage terms.

The script creates a mirror image in accordance with the selected type from the panel.

Scripts that generate objects based on other objects or data

The script combines forms in the style of a meta-ball (do you know the Russian name for such a form? I do not).

The script creates common (all possible) tangents to the selected objects.

The script creates guides from the selected point to the selected curved segments.

The script allows you to generate a QR code in Illustrator.

With this script, you can automatically create a calendar grid in just a few clicks. Supported languages: EN, RU, DE, UA.

Scripts with a random parameter

The script selects objects in random order according to the specified number.

The RandomSwatchesFill script randomly colors the selected objects in the colors selected in the Swatches palette.

The RandOpacity script changes the transparency of selected objects at random in the range from 0% to 100% of the original transparency of the objects.

The script changes the linear gradient angle of all selected objects in random order.

The Random Order script allows you to distribute objects in a random order in the Layers panel. I used this script when writing

Scripts for working in the Layers panel

The script deletes all empty layers in the current document.

You have a unique opportunity to expand the functionality of Adobe Illustrator. There is nothing easier than using scripts (script files), just select the object and run the script that you need. The scripts presented in this article will save you a lot of time, make your work more enjoyable and efficient. Believe me, they are worth your attention. All scripts were tested in Illustrator versions CS3 and CS4.

If you need premium quality Illustrator add-ons, you can find them in the Illustrator Actions and Scripts section of our GraphicRiver resource, such as: Isometric Guides Grid Action (isometric mesh action), Pattern Maker, and Long Shadow Action.

   Best Actions (Operations) and Scripts for Illustrator on Graphic River.

Otherwise, use the free "goodies" about which we will now tell you. But first, let's see how to install scripts for Illustrator.

Script Installation

It is advisable to always save the scripts that you are going to use in the same place, for example, in the Scrips directory. To run the script, go to File\u003e Scripts\u003e Another Script (Command + F12) (File\u003e Scripts\u003e Other Scripts).

Open the directory with scripts and run the desired file.

Share this