Select all & group, scale Strokes & Styles via JavaScript?

Hello

I really wish the Forum search worked, because I'm sure that this issue has been addressed...

(1) is there a way to access the selection > all (Ctrl + A) and object > Group (Gtrl-G) using JavaScript controls?

If I was doing the process "in hand", I must select > all (Ctrl + A), group (Ctrl + G), create a new layer, cut (Ctrl + X) and paste (Ctrl + V).

My first attempt to do this programagically had to loop through all the elements of the art and the method move() to move one by one in a new GroupItem on the new layer. However, the results questionable cases at best because of the variability in the amount of nested groups, composed of path elements, masks clipping, etc..

So, I can probably get the feature select all by a loop through the objects of art and in implementing selected = true, but how can I get all those items in a single GroupItem all-at-once instead of one at a time?

(2) once I have everything in a single GroupItem, I would like to re-group size. However, using the resize() does not offer an option to scale the contours and the effects, as you can see, when you go to object > transform > scale...

Is it possible for a group with contours and effects scale lit via JavaScript?

Thanks for the comments!

No, JS can not play actions

no calculation, race number of scale is also in percent

Tags: Illustrator

Similar Questions

  • Select all sections in cs4

    When registering for the web and devices in photoshop cs3 I could select all groups by pressing ctrl + has, that no longer works, now I have to press and hold and click all the slices. Is there sort of to do this faster?

    -Mic

    Click and drag a selection rectangle around all the slices with the slice Selection tool

  • JavaScript: select all of the text, break the link style

    Hello

    I want to select all the text in a Document (in different independent text boxes) and then break the link of his style (in the program in the paragraph styles dropdown)

    Is this feature that can contain a script (javascript)?

    How to select all the text?

    InDesign CS6, OS10.7.4

    Thank you

    Hello

    app.activeDocument.stories.everyItem (). texts.everyItem () .applyParagraphStyle (app.activeDoc ument.paragraphStyles.item (0), false);     This should be applied [none] formats paraStyle and keep. the same charStyles.

    Your goal will be reached with the exception of the formats defined by using the definition of paraStyle info NestedStyle (GREP, NestedLineStyle)

    ==> those who disappear, I'm afraid.

    I hope that...

  • How to replace a color in any plan of work in illustrator by using Javascript (without selecting all objects)

    Screen Shot 2016-02-15 at 5.37.24 pm.png

    A common way is to loop through every element in the document and change its values of the background color or contour, or in the case of text, attributes of character for the fill and the outline of the text characters. This can take some time if you have many objects. In addition, if you have the color applied via the graphic styles or appearances, they are not detectable via javascript. But if you had your spot colors, you can change the values of these tasks of swatch and color will be updated in all aspects of the document, including the graphic styles, brushes, etc..

    Here is an example of editing a fill for a TextBox inside a CMYK document:

    #target illustrator
    function test(){
        // must have cmyk document with one text frame (which contains at least one character) and one path for this test.
    
        // a simple function to assign the cmyk values to a cmyk color
        function editCMYKValues(affectedColorObject, c, m, y, k){
            affectedColorObject.cyan = c;
            affectedColorObject.magenta = m;
            affectedColorObject.yellow = y;
            affectedColorObject.black = k;
        };
    
        var doc = app.activeDocument;
        var t = doc.textFrames[0];
        var myTexFill = t.textRange.characterAttributes.fillColor;
    
        editCMYKValues(myTexFill, 100, 100, 25, 25);
    
        var p = doc.pathItems[0];
        editCMYKValues(p.fillColor, 25, 100, 100, 25);
    
    }
    test();
    
  • Select all objects with the same style of object?

    I did some research but empty is come. It is possible to select all the objects on a page that have the same style of applied object?

    What I want to do, is apply an action 'frame content' to a large group of text boxes (labels on a map). But this mounting option doesn't seem to be available as part of the style of the object.

    Any suggestions?

    Thank you.

    Try using the option Auto-size text block rather in the style of the object. This feature (found in the object > text frame Options) is useful to the legends of autosize following certain rules.

    This attribute can be used in object styles.

  • Ungroup all groups on a layer (JavaScript) active.

    Does anyone know how you would you unlink all groups on a layer active with JavaScript?

    looking for "Recursion", check this thread, Mark has an example of recursion of layers and groups.

    http://forums.Adobe.com/message/3387938#3387938

  • (CS3; JavaScript) how effectively "select all" / performing an action

    Hi all

    while I found little code to run applescript action I need to be able to do from JavaScript. The documentation does not mention at all of the shares.

    It would save me a lot of work if I could just perform an action that changes the color of the document to CMYK instead of having to duplicate all objects in a new document (I have already created the action and it works)

    This brings me to my other question: are there really no "select all"? It takes almost 2 seconds (at least if the Profiler is right) just to select a simple 300 objects in my test file. I need to batch process something like 30 records that could prove more complex and I don't like the idea to say to my colleagues that they should wait for so long...

    Is there a better way that a loop through pageItems and setting .selected = true?

    I could imagine performs an action that selects all objects (how to copy actions to others machines. btw?) or to run the shortcut (Ctrl + a).

    Thank you very much

    Mike

    Good evening

    Void test_ai()

    Set myAi = CreateObject ("illustrator.application.CS4")
    Set myDocAi = myAi.ActiveDocument

    ' - An idea is to show, as a first step, the layers on which you want to select all objects.

    myDocAi.Layers ("myLayerWithObjects"). Visible = True
    myDocAi.ActiveLayer.Locked = False

    myDocAi.Layers ("mySecondLayerWithObjects"). Visible = True
    myDocAi.ActiveLayer.Locked = False

    ' - In a second step, you select all

    For each myLayers in myDocAi.Layers
    If myLayers.Visible = True Then myLayers.HasSelectedArtwork = True
    Next

    ' - and finally, you define a variable with your selection

    myselexion = myAi.Selection

    End Sub

    After that, you will probably identify each item of your choice.

    Best regards

    Patrice

  • Call javascript function when select all is checked the report

    Hi Experts

    Ive a tabular manual from query below

    SELECT Apex_item.checkbox (1, ID, 'onclick = enableButton ()') select, a, b, c of table

    By choosing 1 or more checkbox individually, enableButton() is called, and works very well as expected

    However when select all is done, I do not know how to call the same function

    Position of column select is: < input type = "checkbox" onclick = "$f_CheckFirstColumn (this)" / > (topic is a checkbox, check, selects all rows in the report) "

    I tried: < input type = "checkbox" onclick = "$f_CheckFirstColumn (this)" onclick = "javascritp:enableButton(); "/ >. It does not help

    Is it possible to call the function when select all is checked?

    Thank you

    Archana

    I changed the title of the

    This solved my problem.

    Thank you

  • Select all the objects with 2pt STROKE?

    It is possible to select all objects with a particular characteristic, such as a specific line width? I know I can do this by selecting an object, and then choose Select all. But I want to include as part of a batch action, so I need to be able to specify the choice so that it can be completely automated. If I have to choose one of the objects for each file, it defeats the purpose of the action of batch processing.

    If this is not possible, I should ask in the forum script to help a script?

    NW

    With nothing selected, the value of the weight of the 2pt race. Now select > same > weight of the race.

    Set the weight of the race is registrable and if nothing is selected, then select it > same commands using what is defined in the panels.

  • Select all the fields of the same type?

    Y at - it an easy way to select all fields in all of the document of the same type (all text fields, or select all of the checkboxes)? This way I can edit them all at once for the same properties. It would be easier than several selections of drag or picking out of the field list.

    You can place the following script as the mouse Up JavaScript for temporary button. Or you can copy them into the interactive JavaScript console (Ctrl + J), select all and press Ctrl + Enter to execute it.

    To loop through all the fields in the form

    for (var i = 0; i)< numfields;="" i++)="">

    Get a reference to the current field

    var f = getField (getNthFieldName (i));

    Put a yellow background

    and the style of check to cross

    If (f.type = "checkbox") {}

    f.fillColor = color.yellow;

    f.style = style.cr;

    }

    }

    You will need to change to change field properties to change. They are documented in the Acrobat JavaScript reference, which is included in the free Acrobat SDK. Post again if you need help with the names or values you want to use.

  • transform &gt; represent the objects in illustrator via javascript

    Hi all

    is there a way to transform > reflect the Vertical axis in illustrator, but via JavaScript not apple and I mean does not reflect the scale H or V

    Thanks in advance.

    Hi Muhammad.eloc,

    You can try something like this:

    var totalMatrix = app.getScaleMatrix(-100,100);
    app.activeDocument.activeLayer.pathItems[0].transform(totalMatrix);
    

    for example the first element of the path in the active layer

    Have fun

  • How can I select all checkboxes in a form?

    I use Adobe Acrobat Pro XI.  I want to select all the check boxes on the form and change the style to place a full square on a checkbox "enabled" to using a real check mark in the check box.  I can do this check box one at a time or select several checkboxes in scrolling down a dozen pages.  How can I just select all the boxes?  Why is there not a selection > select all > select all checkboxes, or equivalent?

    Thank you.

    You must write JavaScript to access each field, the type of field test and for each checkbox change the style.

    You can run the following script in the JavaScript console or by a button:

    var nNumFields = this.numFields; get the number of fields in the PDF file.
    Console.println ("There are" + nNumFields + "in this document.") display the number of fields;
    var cFieldName; variable to the name of the field to be addressed;
    var oField; varialbe for object file to process.
    for (i = 0; i< nnumfields;="" i++)="">
    get each field in the PDF file.
    cFieldName = this.getNthFieldName (i); Get i name field;
    oField = this.getField (cFieldName); get the field for a field named object;
    test to check bosx type;
    If (oField.type == "checkbox") {}
    style assigned to cross;
    oField.style = style.cr;
    Set other properties required
    display the field that was changed;
    Console.println (oField.name + "field type" + oField.type + "has been changed to a cross.");
    } / / end of type checkbox.
    } / / get field next to treat;

  • How to change the "TextVariable" via javascript

    Hello

    How can I change the value of a "Custom text Variable" via javascript in indesign CS5?

    I understand that there is a 'content' that is me allotted property, but I can't understand how to set or change.

    Here's the javascript code example for reference.

    var docRef = app.activeDocument;
    
    
    for ( var i = 0; i < docRef.textVariables.length; i++ ) {
    
    
        var textVariableItem = docRef.textVariables[i];
    
    
              // Check for the type
              if (textVariableItem.variableType === VariableTypes.CUSTOM_TEXT_TYPE){
    
    
                        var variableOption = textVariableItem.variableOptions;
      
                        // This will give me the text value of the variable
                        alert("Text Variable " + i + " \n " + textVariableItem.name + "\n" + variableOption.contents);
    
    
                        // But how do I set it? 
                        // The following does not seem to work 
                        variableOption.contents = "New custom text..."; 
              }
    }
    
    // Logic behind this script
    
    // theScript()
    // is a wrapper function to provide functional scope to the entire script
    // This function is invoked at the very bottom of the file
    
    // main();
    // the main function that gathers the initial parameters and launches the dialog box
    
    // function mainDialog(docRef, selectedItems, layers, inputs)
    // A function that creates a dialog box this function is passed as a parameter to a "factory method"
    // called function sfDialogFactory(dialog)
    // which is a general purpose utility for creating dialog boxes.
    
    // The mainDialog function has a callback function that responds to the "comtinue" button and after some validation
    // makes a call to a function called
    
    // function doAction(docRef, inputs, options)
    // This is where the main behvior of the script is suppose to be defined.
    // it is designed to be called AFTER the dialog box return and is the result of the callback inside mainDialog
    // The doAction function receives objects that are parameter holders for various inputs and options that come from the
    // dialog box presented to the user
    
    function theScript() {
    ///////////////////////////////////////////////////
    // BEGIN THE SCRIPT
    //=================================================
    
    ////////////////////////////////////////////////////////////////////////////////
    // SCRIPT MAIN PROCESS
    ////////////////////////////////////////////////////////////////////////////////
    // Main Process
    // The beginning of the script starts here
    // Add main logic routine to this function
    
    // Call Main Function to get the ball rolling
    var elementsData;
    var theDocument = app.activeDocument;
    var inputGroup;
    main();
    
    function main(){
    var theSelectedItems = theDocument.selection;
    var theLayers = theDocument.layers;
    
        var myDialog = sfDialogFactory(mainDialog(theDocument, theSelectedItems), theLayers);
        var result = myDialog.show();
        if (result == 1){
            newAction();
            alert("Done");
            }
        else{
            alert("Not Done");
            }
    }
    
    ////////////////////////////////////////////////////////////////////////////////
    // SCRIPT SUPPORTING FUNCTIONS
    ////////////////////////////////////////////////////////////////////////////////
    // Supporting Functions
    // Include functions that offer partial functionality
    // These functions are called and acted upon within the mainProcess function
    function newAction(){
    
            var formData = getControlValues(inputGroup);
            var inputs = {};
            var options = {};
           // alert("callback get form data");
          // Do something with formData values here
            var cLen = formData.controls.length;
            var formValues = '';
            for (var c = 0; c < cLen; c++ )
            {
                if (formData.controls[c].name === "inputECONumber") {
                    inputs.inputECONumber = formData.controls[c].value;
                    // alert(formData.controls[c].name + " | " + formData.controls[c].value);
                }
    
                if (formData.controls[c].name === "inputDocumentName") {
                    inputs.inputDocumentName = formData.controls[c].value;
                    // alert(formData.controls[c].name + " | " + formData.controls[c].value);
                }
    
                if (formData.controls[c].name === "inputDocumentNumber") {
                    inputs.inputDocumentNumber = formData.controls[c].value;
                    // alert(formData.controls[c].name + " | " + formData.controls[c].value);
                }
    
                if (formData.controls[c].name === "inputDocumentRevision") {
                    inputs.inputDocumentRevision = formData.controls[c].value;
                    // alert(formData.controls[c].name + " | " + formData.controls[c].value);
                }
    
                if (formData.controls[c].name === "inputDocumentType") {
                    inputs.inputDocumentType = formData.controls[c].value;
                    // alert(formData.controls[c].name + " | " + formData.controls[c].value);
                }
            }//End FOR
        doAction(theDocument, inputs, options);
        }
    
    function mainDialog(docRef, selectedItems, layers, inputs) {
    
    // Main Dialog
    // alert("Main Dialog: " + docRef.name);
    
    if ( docRef === undefined ) {
      alert("Cannot Execute, please select a document.");
    }
    
      var currentData = getMetaData();
    
      var dialogObj = {};
    
      dialogObj.groups = []; // An array of dialog groups
      dialogObj.title = "Update Meta Data";
    
      var groupLabelInfo = {};
      groupLabelInfo.title = "Edit: " + docRef.name;
    
      // Add Elements using JSON shorthand syntax
      groupLabelInfo.elements = [
        {
            "name":"labelECONumber",
            "type":"statictext",
            "value":"Engineering Change Order (ECO) Number",
            "visible":true
        },
        {
            "name":"inputECONumber",
            "type":"edittext",
            "value": currentData.inputECONumber,
            "visible":true
        },
    
        {
            "name":"documentName",
            "type":"statictext",
            "value":"Document Name",
            "visible":true
        },
        {
            "name":"inputDocumentName",
            "type":"edittext",
            "value": currentData.inputDocumentName,
            "visible":true
        },
    
        {
            "name":"documentNumber",
            "type":"statictext",
            "value":"Document Number",
            "visible":true
        },
        {
            "name":"inputDocumentNumber",
            "type":"edittext",
            "value": currentData.inputDocumentNumber,
            "visible":true
        },
    
        {
            "name":"documentRevision",
            "type":"statictext",
            "value":"Revision",
            "visible":true
        },
        {
            "name":"inputDocumentRevision",
            "type":"dropdownlist",
            "value": currentData.listRevisions,
            "visible":true,
            "selection":currentData.selectionRevision,
        },
    
        {
            "name":"documentType",
            "type":"statictext",
            "value":"Label Type",
            "visible":true
        },
        {
            "name":"inputDocumentType",
            "type":"dropdownlist",
            "value": currentData.listDocumentTypes,
            "visible":true,
            "selection":currentData.selectionDocumentType,
        },
    
      ];
    
      // Add to groups to list
      dialogObj.groups.push(groupLabelInfo);
      return dialogObj;
    }
    
    function doAction(docRef, inputs, options) {
    
    alert("doAction " + docRef.name + " \n INPUTS: \n" + inputs.reflect.properties + "\n\n OPTIONS: \n" + options.reflect.properties);
    
    // Get the current contents
    
    var fooContents = app.activeDocument.textVariables.item ('Foo').variableOptions.contents;
    var barContents = app.activeDocument.textVariables.item ('Bar').variableOptions.contents;
    
    alert("GET textVariable contents \n Foo: \n" + fooContents + "\n\n Bar: \n" + barContents);
    
    // Set/Update the contents
    // Why does this not seem to work?
    
    alert("SET textVariable contents \n Foo: \n" + inputs.inputDocumentName + "\n\n Bar: \n" + inputs.inputDocumentType);
    
    app.activeDocument.textVariables.item ('Foo').variableOptions.contents = inputs.inputDocumentName;
    app.activeDocument.textVariables.item ('Bar').variableOptions.contents = inputs.inputDocumentType;
    
    // Script does not seem to reach this point. Why?
    alert("END of doAction");
    }
    
    // A Factory function for creating dialog boxes
    
    function sfDialogFactory(dialog) {
    
        // A factory method for creating dialog screens
    
        // Dialog Window
        var d = new Window("dialog", dialog.title);
    
        // alert("Number of Inputs" + dialog.inputs.length);
        // alert("Number of Options" + dialog.options.length);
    
        var i; // counter
        var len; // length of array elements
    
        // Generate Groups
        if (dialog.groups.length > 0) {
    
            len = dialog.groups.length;
            for (i = 0; i < len; i++ )
            {
                var currentGroup = dialog.groups[i];
                inputGroup = d.add ("panel", undefined, currentGroup.title);
                    inputGroup.alignChildren = ["fill","fill"];
    
                if (currentGroup.elements.length > 0) {
                    // Add Elements
                    var ii;
                    var elemLen = currentGroup.elements.length;
                    for (ii = 0; ii < elemLen; ii++ )
                    {
                        var currentElement = currentGroup.elements[ii];
    
                        var el = inputGroup.add(currentElement.type, undefined, currentElement.value);
    
                        // Additional properties added for future reflection
                        el.elName = currentElement.name;
                        el.elIndex = ii;
    
                        switch(currentElement.type)
                        {
                            case "statictext":
                                el.visible = currentElement.visible;
                            break;
                            case "edittext":
                                el.visible = currentElement.visible;
                            break;
                            case "dropdownlist":
                                el.visible = currentElement.visible;
                                el.selection = currentElement.selection;
                                el.onChange = currentElement.onChange;
                            break;
                            case "checkbox":
                                el.visible = currentElement.visible;
                                el.value = currentElement.value;
                            break;
                            default:
                            throw new Error('Unknown Dialog Element Type [' + currentElement.type + ']');
                        }
    
                    }
                }
            }
        }
    
      // Buttons Group
      var buttonGroup = d.add("group");
      var bOK = buttonGroup.add("button", undefined, "Continue", {name: "ok"});
      var bCANCEL = buttonGroup.add("button", undefined, "Cancel", {name: "cancel"});
    
      return d;
    }
    function getControlValues(set) {
        elementsData = {};
        elementsData.controls = [];
        // TO DO Add more types
    
        var giLen = set.children.length;
        for (var gi = 0; gi < giLen; gi++ )
        {
            var child = set.children[gi];
            // alert(objReflection(child, "none", false));
            // alert(child.type);
            var control = {};
                control.name = child.elName;
                control.index = child.elIndex;
                control.type = child.type;
                control.visible = child.visible;
            switch(child.type)
            {
                case "statictext":
                    control.value = child.text;
                break;
                case "edittext":
                    control.value = child.text;
                break;
                case "dropdownlist":
                    control.value = child.selection.text;
                break;
                case "checkbox":
                    control.value = child.value;
                break;
                default:
                throw new Error('Unknown Dialog Element Type');
            }
            elementsData.controls.push(control);
            // alert(objReflection(control, "none", false));
        }
        return elementsData;
    }
    function getMetaData() {
    // Return a data structure that contains meta data from the document.
    
        var dataObject = {};
    
         // Default arrays
         dataObject.listRevisions = generateRangeOfNumbers ("r", 1, 100);
         dataObject.listDesignComps = generateRangeOfNumbers ("Comp_", 1, 100);
         dataObject.listDocumentTypes = [
                         "Datasheet",
                         "Manual",
                         "Tech Guide",
                         "Other"
                     ];
    
         // Set Sensible Default Values for the UI Form
         if (!dataObject.inputECONumber) {
             dataObject.inputECONumber = "###ECO###";
         }
    
         if (!dataObject.inputDocumentName) {
             dataObject.inputDocumentName = "Document Name";
         }
    
         if (!dataObject.inputDocumentNumber) {
             dataObject.inputDocumentNumber = "048-xxx-30";
         }
    
         if (!dataObject.inputDocumentRevision) {
             dataObject.inputDocumentRevision = "r01";
         }
    
         if (!dataObject.inputDocumentType) {
             dataObject.inputDocumentType = "Datasheet";
         }
    
         return dataObject;
    
    }
    
    function generateRangeOfNumbers (prefix, start, end) {
        // This function generates an array of sequential numbers within a range
        // prefix = string to append to beginning of each element
        // start = the beginning of the range
        // end = the end of the range
        // length = overall number of cycles to loop through, start and end must fall within this value
    
        var output = [];
    
        for ( var i = start; i <= end; i++ )
        {
            if (i < 10) {
                // Add a leading zero
                output.push(prefix + "0" + i);
            }
            else {
                output.push(prefix + i);
            }
        }
    
        return output;
    }
    
    //=================================================
    // END THE SCRIPT
    ///////////////////////////////////////////////////
    }
    
    theScript();
    

    I modified your code shortly. He works for me here. Check it out...

    Thank you

    Green4ever

  • Active script that selects all of the items spread

    I'm trying to find a 'simple' script that selects all elements on the page, either a group or individual items without using a dialog window. Is there a selection simple javascript to select all the objects on a page or spread for InDesign CS3? I'm new to this sort of thing script.

    Hey!

    PankChat is right, but you can't 'see' the selection.

    If you want to 'see' what is selected, try this:

    app.select(app.activeWindow.activePage.allPageItems);
    

    tomaxxi

  • I'm trying implement highlight/select all mails from a particular sender to remove

    My Inbox needs serious editing. A lot of unwanted emails. I would like to delete e-mails in groups, but do not know how to select or highlight an entire group, which can then be removed.

    You can click on any column heading to sort by that column. Clicking the same header again reverses the sort.
    Then you use basic computer skills to select multiple items
    Click the point 1. Up or down several elements and hold down the SHIFT key when you click on the point 2. This allows to select the elements 1 and 2 and everything in between.
    Holding down the CTRL key and clicking on random element will select all clicked on element.
    Select an item. Press Ctrl + a to select.
    Hold down the CTRL key when you click on a selected item to deselect the item.

Maybe you are looking for

  • T400: BSOD with Intel GMA 4500MHD

    Hello I own a Lenovo T400 (2767-B44). I am using Windows XP SP3, with the latest drivers on the Lenovo support for this model site Recently I tried to use an external display connected to the laptop's VGA connector. It works very well, we can discuss

  • Faxing with something left in scanner by mitake

    HP Officejet Pro 8600 more e-all-in-One Printer I have to send a fax using the Automatic Document Feeder and found that someone has left something on the scanner glass.  Is it only the elements in the ADF fax? Or he will send what was on the glass?

  • What is the best lens for a photographer to Starter?

    I am a photographer of starter and have a canon 100 d and was wondering what is the best Starter lens? I like to take pictures of landscapes, buildings, landscapes, people and flowers.

  • in accordance with in warranty 2 years

    I had sent request guaranteed 2 years 30 days back, but I can not any confirmation e-mail and how to check my 2 year warranty for laptop

  • New software from Cisco ISE 1.3 on IBM x 3250 series?

    Hi all I need clarification on these three questions: -Like the Cisco ISE 1.3 is released a few days ago, it is possible to install it on another provider of hardware as IBM x 3250 series? -If Yes, how we will manage with smartnet contract? -What the