action or a script to move the selection to the specified layer?

Hi all

I have a work of art on 'Layer 1' I need to shrink and duplicate "layer 2". I do this several times a day, so I was hoping someone could help me with a script? The two layers are always named the same. I work in CS5.


Thank you very much!

Here you go

var scale = 50; // 50 means 50%, change this to your needs

var idoc = app.activeDocument;
var ilayer = idoc.layers['Layer 2'];
var sel = idoc.selection;
var selen = sel.length;

for (i=0; i 
         

Tags: Illustrator

Similar Questions

  • Script to record an action that will convert the sRGB to CMYK file, then use the action in a script to support the process of a folder full of images?

    Is it possible to save an action to convert from sRGB to CMYK, then use the action in a script to support the process of a folder full of images?

    Do action, and run as a batch of PS (file > Automate > batch), or bridge (Tools > Photoshop > batch).

    Pay special attention to all the 'destination', 'save' and 'close' steps. You want to save a copy without overwriting the original, which can easily happen.

  • FDM - a script engine for the specified language cannot be created.

    Hello

    When I try to log into the application of FDM, I get the error message below. FDM - 11.1.1.3 application version. I restarted all services and tried to log in again. But getting same error message.  It was working fine before. Please could you help me solve the problem.

    "Error: an error occurred in the logging on the system." -A script engine for the specified language cannot be created. »

    Thank you

    Michel K

    Your vbscript.dll is corrupt. Replace with a good copy and register again via cmd regsvr32.

  • Script to move a selection from the limits of spread?

    I have a document with a difference much larger than the content in the document.

    1-oversize-pasteboard.png

    I have another template file with a gap corresponding to the size of the limits of all selected objects. I need to open this template, paste the objects, that pasted selection of objects align to the top left of the spread (aka cardboard neighborhood or work?) and then export as a PDF and .eps.

    Due to a lot of confusion about various coordinate systems, my ideal would be not having to move what that at all, but have instead, the upper left corner of the pasted content aligned with the upper left of the spread, as it is glued. Paste or paste in place makes the content where I need them. The objects are too weak.

    2-contents-pasted-too-low.png

    Even if there is a solution to paste the information where it needs to go from the outset, I would like to know how make a difference compared to the visible work area (I think it is properly known as the spread, but more commonly referred to as the mount table?) I want to just make sure I ask my question correctly so my intentions are understood).

    My first test with the following line of code produces the result seen in the next picture; only the background .eps object is moved, and it moves down.

    App.Selection [0]. Move([MyPage.Bounds[0]+myMargins.Top,MyPage.Bounds[1]+myMargins.Left]);

    3-first-try-to-move.png

    My second test is shown below; It seems also only reposition the background image, but something moved too far down and to the right. It seems that it may be of the same size and shape, like spread which I copied objects. The limits of selection have the right size when I stuck first the object in the new document, until the line of code to change the geometric limits has been executed.

    App.Selection [0] .geometricBounds = [myPage.bounds [0] + myMargins.top, myPage.bounds [1] + myMargins.left, myPage.bounds [2] - myMargin s.bottom, myPage.bounds [3] - myMargins.right];

    4-2nd-try-to-move.png

    Also, previous attempts (until I added the image of the Tiger, the text to its immediate left and a red rectangle behind the Tiger) saw all objects selected EXCEPT the background .eps image move upward and in the right position using app.selection [0] .geometricBounds.

    Any help would be greatly appreciated. Here is the code and a screenshot of the objects on the layer that are involved.

    indesign #target - 11.064 / / CC 2015

    myDoc = app.activeDocument;

    myPages = app.activeDocument.pages;

    myActivePage = app.activeWindow.activePage;

    // 1. Select and copy everything on this document activePage

    App.Select (SelectAll.All);

    App.Copy ();

    // 2. Open the template file and paste

    whichExportTemplate = "FCILG";

    myTemplateFolder = ' / Users/user/Documents /!  "Resources / models / Ted signs / Tags ';

    sFileName = myTemplateFolder + "/" + whichExportTemplate + ".indd".

    sFileName = sFileName.replace (/ % 20/g, "'" ");

    newDoc = app.open (File (sFileName));

    app.pasteInPlace ();

    App.Select (SelectAll.All);

    // 3. POSITION IT

    var myPage = myActivePage;

    var myMargins = myPage.marginPreferences;

    App.Selection [0] .geometricBounds = [myPage.bounds [0] + myMargins.top, myPage.bounds [1] + myMargins.left, myPage.bounds [2] - myMargin s.bottom, myPage.bounds [3] - myMargins.right];

    App.Selection [0]. Move([MyPage.Bounds[0]+myMargins.Top,MyPage.Bounds[1]+myMargins.Left]);

    // 4. Save the new file

    // 5. Close

    5-layers.png

    Would you mind bringing together all elements of the page on the page, you have a single object to process after duplication (I prefer duplicate() on app.copy () / app.pasteInPlace ()) without selecting anything? Just answer has all the elements of the page on your source page to add a group and manage this unique group object.

    Quick and dirty:

    //TWO InDesign documents are open
    //The SOURCE document is the ACTIVE one
    
    var myTargetDoc = app.documents[1];
    
    myTargetDoc.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;
    myTargetDoc.zeroPoint = [0,0];
    
    //Group everything on the active page of your SOURCE document:
    var myActivePage = app.layoutWindows[0].activePage;
    var myGroup = myActivePage.groups.add( myActivePage.pageItems.everyItem().getElements() );
    
    //Target the second document for the duplicate of the group:
    var myDuplicate = myGroup.duplicate(myTargetDoc.pages[0]);
    
    //Move the duplicate:
    myDuplicate.move([0,0]);
    
    //Tidy up a bit:
    myDuplicate.ungroup();
    myGroup.ungroup();
    

    Hope, that helps.

    Uwe

  • Is there an action or a script to remove the variables?

    I have about 500 files created from a source model and a variable (of 500 sets of data). Each of the 500 output files includes the library of variables. I want to separate the object and remove the variable in each of these output files. It will take hours to open each file and manually remove the variable, so I hope that it might be possible to automate this process with a script or a batch action. Unfortunately, however, I don't know enough script to create the script myself. Are there commands that can be combined in an action, or y at - it an existing, to achieve this script?

    Thank you very much.

    Maybe that someone else can promote the use of 'actions' for this?

    About scripting:

    Give a try on a "test copy" of one of your files and see if it's what you want.

    function removeDataSetsAndVariables() {
        if (app.documents.length > 0) {
            var doc = app.activeDocument;
            var dS = doc.dataSets.length;
            var v = doc.variables.length;
            var curV;
            if (v > 0) {
                for (var i = v - 1; i >= 0; i--) {
                    curV = doc.variables[i];
                    curV.remove();
                }
            }
            if (dS > 0) {
                doc.dataSets.removeAll();
            }
        }
    }
    removeDataSetsAndVariables();
    

    In my quick test, the code snippet above will remove all the variables and data sets, is that what you need/want? If Yes, then we can proceed from there. Let us know.

  • Script to move the same objects of value of color to a layer

    I have a range of color objects upward into process colors, and I would like to the moved to the individual layers of script.

    so the result would be to move all items from cyan to CYAN layer, move all the magenta elements to the Magenta layer, etc. etc.

    Could someone help please?

    Thank you very much

    something like this will do the trick.

    Don't forget: this can make a mess of your z-order...

    function seperate_items_to_layers_by_colour(){
        var doc = app.activeDocument;
        var item = doc.pageItems;
        var C_lay = make_layer_if_needed("CYAN");
        var M_lay = make_layer_if_needed("MAGENTA");
        var Y_lay = make_layer_if_needed("YELLOW");
        var K_lay = make_layer_if_needed("BLACK");
    
        for(var i=0; i		   
  • Script to move the playhead randomly to executives?

    Is it possible to have a script that sends the playhead to specific images at random, wait about 8 seconds then go?

    For example, frames 1-20 will have an image on each image. I want the playhead to land on these images in a different order and keep a loop.

    Thank you

    I did not code it if you return to section 1, code it so that when you return to frame 1, you launch a setInterval another... you want only a job.  If you place the following code in frame 1 it will take care of it, leaving a setInterval be activated...

    Stop();

    var intervalID; intervalID is undefined here because there is nothing assigned

    if(!intervalID) {/ / will only when intervalID is undefined}
    intervalID = setInterval (moveToFrame, 3000); defines intervalID
    }

    function moveToFrame() {}
    gotoAndStop (Math.floor (Math.random () * 4) + 1);
    }

  • Script to move the description metadata information in the title field

    I tried for 2 days (market) to try to get Bridge CS6 to copy the information in the Description field for the field title in the metadata. I can get it in the menu, but nothing happens when I change other scripts. Any suggestions would be greatly appreciated.

    If you want a good laugh, I can post my previous attempts.

    It is a way to copy the information...

    #target bridge
     if( BridgeTalk.appName == "bridge" ) {
    descToTitle = MenuElement.create("command", "Description to Title", "at the end of Tools");
    }
    descToTitle.onSelect = function () {
     if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
     var thumb = app.document.selections;
        for(var s in thumb){
     if(thumb[s].hasMetadata){
            var selectedFile = thumb[s].spec;
      var myXmpFile = new XMPFile( selectedFile.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);
      var myXmp = myXmpFile.getXMP();
             var Description =  getArrayItems(XMPConst.NS_DC, "description");
            myXmp.deleteProperty(XMPConst.NS_DC, "title");
            myXmp.appendArrayItem(XMPConst.NS_DC, "title", Description, 0, XMPConst.ALIAS_TO_ALT_TEXT);
            myXmp.setQualifier(XMPConst.NS_DC, "title[1]", "http://www.w3.org/XML/1998/namespace", "lang", "x-default");
        }
    function getArrayItems(ns, prop){
    var arrItem=[];
    try{
    var items = myXmp.countArrayItems(ns, prop);
     for(var i = 1;i <= items;i++){
     arrItem.push(myXmp.getArrayItem(ns, prop, i));
         }
    return arrItem;
    }catch(e){alert(e +" Line: "+ e.line);}
    }
            if (myXmpFile.canPutXMP(myXmp)) {
            myXmpFile.putXMP(myXmp);
            myXmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);
             } else {
      xmpFile.closeFile();
            }
        }
    }
    
  • Run-time error '380': a script engine for the specified language cannot be created.

    I have a brand new Dell Inspiron, Windows 7 Professional.  I'm trying to load a training program that I already use on a Lenova running Vista 32 bit Service Pack 2.  The load starts and then pops up this error message.  I tried to start the compatibility mode for older software but no change.

    Any thoughts would be appreciated.

    You have installed Windows 7 SP1?

    Error "Script engine for this specified language does not exist, #380.. When you try to run an integration
    http://support.Microsoft.com/kb/859712

    http://www.Google.com.au/search?q=%22specified+language+%22+380&SourceID=IE7&RLS=com.Microsoft:-to the: IE-address & ie = & oe = & redir_esc = & ei = mciAfUh7yHBg-CVToqLI-E

    Try right click on the actual Setup.exe and choosing the option "Run As Administrator"?  Perform, even if your user name is an administrator.

    Have you tried right clicking on the shortcut to the program or the .exe and select "Run As Administrator"?  Perform, even if your user name is an administrator.

  • How to move the canvas layer unless it endangered endangered

    I create a collage of photos on a single canvas.  Each image is its own psd file.  I created a new file with a white background.  Then I "place" each file photoshop on the Web.  Each 'placed' file is its own layer.  However, I want to do is drag the layer to the canvas.  When I drag the layer, the layer disappears beyond the borders of the canvas.  I want that the layer will not disappear, but are instead of the Web until I'm ready to place it on the canvas.  This is similar to when you work on a puzzle and all the pieces of the puzzle are outside the borders of puzzle.  Then when you place a piece, place you it inside the borders.  How can I do this?

    Why not work with a lot more great Web and harvest when you need to produce the final output?  You could even create a layer that puts a nice little traced the border around your prospective Web, that might help you work.

    Trying to keep the data outside the visible drawing area is perilous.  Some operations affect only the visible data and others may result in loss of all data outside the edges of the canvas.

    -Christmas

  • move the selection to the new work plan

    Hi guys,.

    I'm new to Illustrator script but I have done some in InDesign.

    I want a script to move a selection to a new work plan and be able to name the work plan.

    I can't find something in the DOM as artboards.add ().

    Any help?

    Hi jakec88782761,

    are what version of picture you?

    Working with work plans is possible since CS4 +.

    Here's a simple example in [JS]

    var AB_1 = activeDocument.artboards.add([0,50,200,0]);
    AB_1.name = 'first quadrant';
    var AB_2 = activeDocument.artboards.add([-200,50,0,0]);
    AB_2.name = 'second quadrant';
    var AB_3 = activeDocument.artboards.add([-200,0,0,-50]);
    AB_3.name = 'third quadrant';
    var AB_4 = activeDocument.artboards.add([0,0,200,-50]);
    AB_4.name = 'fourth quadrant';
    

    Have fun

  • Action of 'Reply with template' missing the Message filters choice "perform these Actions."

    Hello

    I just installed the latest version of Mozilla Thunderbird (24.4.0) and I am trying to create a "vacation response." I read on Mozilla's Support site:

    Another option is to create a message filter and respond to all incoming messages with a model.

    (see https://support.mozilla.org/en-US/kb/vacation-response?esab=a & s = out + of + the + office & r = 3 & as = s )

    I created a template and saved, and then I tried to create a message filter. However, there is no option for "Reply with template" in the list of choices for the action to perform. I see choices of action, for "Copy Message To", "move the Message to ' and"Forward Message To", but not"answer with model.

    Why is it missing and how to get what it appears?

    Thank you for helping.

    Hi sfhowes,

    I think I knew what is happening.

    First of all, I am a new user of Thunderbird. I have been using e-mail program from Apple on my Mac for many years. Since the upgrade to Maverick, his remark that the Mac mail program is unstable sometimes causing my Mac to freeze, sometimes lose my ability to change windows desktop, and slow clumsy scrolling problems in the e-mail program, but also the temporary e-mail program freeze.

    I installed the latest version of Thunderbird this weekend and am just become familiar with it. I have configured all 8 of my email accounts and they all worked very well. Then I added the Conversations module and I wanted to be able to rearrange the order of my eight accounts and found that Folderpane Tools was the ticket and it worked... had not noticed it was only up to 23... but it worked on 24.

    I said incorrectly that the Folderpanes changed the way that my folder pane displays things. It's the Conversation that made... FolderPane Tools let me reorganize and that's all. But information changed the way the things that have been presented in that in records added to organize by inboxes, sent, trash, etc. And models was one of these records, he added.

    Being unfamiliar with the models as I'm new to Thunderbird. Here is what happened. I created a message and saved as a template. I didn't realize that it was married to a particular account. And when I looked at the file of models I do not remember to see a subfolder for the specific account, for which the model was.

    After reading your last email that I removed the two add and my accounts appears in the folders pane as they did originally, most notable was the Inbox and folders of model disappeared.

    I tried to create a filter for a specific account and the problem remains, but I was wondering where my registered design went because I couldn't find it. So I created another and discovered that has created a new folder called Templates for the account that I was trying to make the filter "reply with template". And then I could see the "reply with template" option when creating a filter.

    To understand what was wrong in the first place, I reinstalled the Conversations, and all folders (Inbox, sent, trash, models) have been reinstated. I looked in the template folder and saw two subfolders, one for the account that I just created the new model and one for my default account. In my default account was the original model I've saved. And now when I try to create a filter by using the original template, I see the answer with the template option.

    I can no longer reproduce the problem since the Conversations, creating a second template and then uninstalling reinstalling Conversations.

    So, the problem is solved, but something is not quite write when the first model created during the installation of the add-on of Conversations. I don't remember see a subfolder in the Templates folder when I created the first model... I could be wrong, but all I remember is the model itself in the Template folder, and not in a subfolder. So I guess that the answer with the Template option did not appear because the model I made did not seem to be assigned to an account.

    Thanks for help.

  • Move the group to another group

    Hi all

    Can help to create a script to move the group named "Shine" in another group named "shine everything."

    Thanks in advance.

    Snapshot show for a better understanding.

    set.jpg

    Does that help?

    // move groups of a certain name into group of a certain name;
    // 2015, use it at your own risk;
    #target "photoshop-70.032"
    if (app.documents.length > 0) {
    var myDocument = app.activeDocument;
    var name1 = "Shine";
    var targetName = "Shine All";
    var targetGroup = layersWithName (targetName);
    // if exactly one group qualifies;
    if (targetGroup.length == 1) {
    // collect groups;
    var theGroups = layersWithName(name1);
    // process groups;
    for (var m = theGroups.length - 1; m >= 0; m--) {
      moveTo(theGroups[m][1], targetGroup[0][1]);
      };
    }
    else {alert ("too many or too few groups called »"+targetName+"«")}
    };
    ////////////////////////////////////
    function layersWithName (thisName) {
    // the file;
    var myDocument = app.activeDocument;
    // get number of layers;
    var ref = new ActionReference();
    ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
    var applicationDesc = executeActionGet(ref);
    var theNumber = applicationDesc.getInteger(stringIDToTypeID("numberOfLayers"));
    // process the layers;
    var theLayers = new Array;
    for (var m = 0; m <= theNumber; m++) {
    try {
    var ref = new ActionReference();
    ref.putIndex( charIDToTypeID( "Lyr " ), m);
    var layerDesc = executeActionGet(ref);
    var layerSet = typeIDToStringID(layerDesc.getEnumerationValue(stringIDToTypeID("layerSection")));
    var isBackground = layerDesc.getBoolean(stringIDToTypeID("background"));
    // if not layer group collect values;
    if (layerSet != "layerSectionEnd" /*&& layerSet != "layerSectionStart"*/ && isBackground != true) {
    var theName = layerDesc.getString(stringIDToTypeID('name'));
    var theID = layerDesc.getInteger(stringIDToTypeID('layerID'));
    if (theName == thisName) {
    theLayers.push([theName, theID)
    }
    };
    }
    catch (e) {};
    };
    return (theLayers)
    };
    ////// move //////
    function moveTo (theLayer, theGroup) {
    // get index;
    var ref = new ActionReference();
    ref.putIdentifier( charIDToTypeID( "Lyr " ), theGroup - 1);
    var layerDesc = executeActionGet(ref);
    var theIndex = layerDesc.getInteger(stringIDToTypeID("itemIndex"));
    // =======================================================
    var idmove = charIDToTypeID( "move" );
        var desc5 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref4 = new ActionReference();
            var idLyr = charIDToTypeID( "Lyr " );
            ref4.putIdentifier( idLyr, theLayer );
        desc5.putReference( idnull, ref4 );
        var idT = charIDToTypeID( "T  " );
            var ref5 = new ActionReference();
            var idLyr = charIDToTypeID( "Lyr " );
            ref5.putIndex( idLyr, theIndex );
        desc5.putReference( idT, ref5 );
        var idAdjs = charIDToTypeID( "Adjs" );
        desc5.putBoolean( idAdjs, false );
        var idVrsn = charIDToTypeID( "Vrsn" );
        desc5.putInteger( idVrsn, 5 );
    executeAction( idmove, desc5, DialogModes.NO );
    };
    

    under the direction

  • Cannot move the text in plan Vanishing Point

    For some reason any when I select some text and try to paste it into a plan of vanishing point, the selection ends up 200% longer than what it should be, and I can not move the text layer in the plan. Screenshot attached.Vanishing-Point-Problem.png

    After pasting the text (or whatever it is already copied to the Clipboard before entering Vanishing Point) in Vanishing Point, there is no reason why you cannot turn freely it adapts to your chosen size and the report l / h.  If the text or object is too big, and FT handles are outside the plane of VP, just do slip down so you can see the upper handles, to scale down and slide it in position.

    Note: when you use FT Perspective on any object (I mean outside VP), he tends to exaggerate the 'length' because that's how we would probably see the object in real life.  I have nearly the only time where I actually click right and choose one option in FT, because it's so easy and fast to Ctrl (Cmd) make dragging a corner or manage a health perspective.

    Unfortunately you get only basic FT size options and the proportions to the bosom of the VP, which is too bad, because you cannot distort your object to encapsulate apparently on a surface curve.  I added a few FT string to this text before it is applied within the VP.  I suspect that miss me a thing or two with VP, I don't use it very often, so I'd love to hear it from someone who has really under control?

  • Error trying to move the file using the file adapter

    Hi, I'm looking for a script to move the file to one remote folder to another by file adapter as described in the topic 4.5.11.1 to http://download.oracle.com/docs/cd/E21764_01/integration.1111/e10231/adptr_file.htm#CHDGFAAB. But I get the below error:

    input > < message > <
    < Invoke1_FileMove_InputVariable > < part name = "Empty" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" > < empty xmlns = "http://xmlns.oracle.com/pcbpel/adapter/opaque/" / > < / piece > < / Invoke1_FileMove_InputVariable > < / input > < fault >
    < bpelFault > < faultType > 0 < / faultType > < bindingFault xmlns = "http://schemas.oracle.com/bpel/extension" > < a name = "summary" part > < summary > Exception is is produced when the link has been invoked.
    Exception occurred during invocation of the JCA binding: "* JCA binding run operations reference 'FileMove' have to: Exception occurred when setting has been invoked.*.
    * Exception occurred during invocation of the JCA binding: "* failed to instantiate InteractionSpec oracle.tip.adapter.file.outbound.FileReadInteractionSpec reason: cannot set JCA WSDL perte.*."
    * The WSDL of JCA perte.* definition error *.
    * The setSourcePhysicalDirectory property is not set to oracle.tip.adapter.file.outbound.FileReadInteractionSpec *.
    * Please check the spelling of the perte.* *.
    ".
    The called JCA adapter threw an exception of resource.
    Please review the error message above carefully to determine a resolution.
    ".
    The called JCA adapter threw an exception of resource.
    Please review the error message above carefully to determine a resolution.
    < Summary / > < / part > < part name = "detail" > < details > can not set the WSDL JCA property.
    Error setting property of WSDL JCA.
    SetSourcePhysicalDirectory property is not set to oracle.tip.adapter.file.outbound.FileReadInteractionSpec
    Please check the spelling of the property.
    < / detail > < / part > < part name = "code" > < null code > < / code > < / piece > < / bindingFault > < / bpelFault > < / fault > < faultType >
    < message > 0 < / message > < / faultType > < / messages >

    Please provide any idea if someone tried it.

    Thank you
    RPS

    Hi rps.

    Your interaction-spec className seems to be incorrect (FileReadInteractionSpec).

        
     .....
        
    

    Please try with the specifications of interaction above and let me know the results.

    Kind regards
    Neeraj Sehgal

Maybe you are looking for

  • IOS10, Coast stars, purchased playlist, iTunes

    I am running IOS10.0.1 on an iPhone 6. I am a subscriber of Apple's music. Where are the freekin' star ratings (?) on Apple's music application? I spent a decade meticulously curating my collection of music using the coast to stars provided. I have a

  • my index.html makes differently if I name index.htm

    I use dreamweaver to create a new Web site. During the test it (named index.html) home page renders correctly in firefox, but looks good in other browsers. I discovered that if I name index.htm or default.html it looks normal. The index.html file jus

  • Pavilion dv7-1245dx Hp TrueVision HD web cam does not. It has worked before.

    Thinking that it is a hardware driver not knowing how to find the TrueVision HD internal.  I used the viewfinder to see if all the drivers are up to date.  Used hp recovery to check for problems, everything is good.   Think the lens must be truned on

  • Benq GW2250 monitor

    I'm unable to install my new BenQ GW2250 22 '' monitor. I tried all the options, BenQ is not yet listed in the list of manufacturers and I can not add it. I have the installation disc, but he says that it is impossible to install? It's more boring!

  • How to use the recovery with a new ssd disk after the death of original hard drive

    I thought I had a simple fix/upgrade for my dv5 - 2077cl. decided to replace the defective hard drive with an SSD. couldn't afford a 240 GB size but it's big enough for my needs. I installed the new drive easily and cycled through my 4 recovery disc