Select the path using script

Hello

Every now and I have a lot of images to save for web (1-2 k images at once). All images are .psd or path or transparent background. I want to select the path and erease backgrount possible triming. The roads are named different, so this is another problem because the actions in photoshop select only the specific name of the track. So, it is possible to select the path regardless of his name? Or how to write the script of selection of several path names (IE "track 1", "path 2", "choice 1"...) I hope you understand what I want to do...

I have another script that resizing of images to corect size and save for web. So when I have jpg with white backgroound first I run action in photoshop to cut images and then I run the script to resize all the images, because the script to check if the image is larger or more...

If you want more information, just ask... I have version CS5 Photoshop

Kind regards

voahyeah

Edit:

For now, I wrote this:

app.activeDocument.pathItems.getByName ('path 2') .makeSelection ();

app.activeDocument.selection.invert ();

app.activeDocument.selection.clear ();

and he choose only if the path name is "path 2" else it stops... "."

So when the personal is way 2 everything is fine but I have 10-15 different names... so it would be great avoid the path names. It is possible to select the first HRAP (if there is more than one)

or if it is not possible to avoid the path name how wrote if els if block for it to check all path names...?

... Thank you

Hi Voahyeah,

Here's the Code...

If (app.documents.length > 0) {}

var app.activeDocument = docRef;

var n = docRef.pathItems.length;

If ((n>0) & (.name docRef.pathItems [0]! = "Work path")) {}

docRef.pathItems [0] .makeSelection ();

docRef.selection.invert ();

docRef.selection.clear ();

docRef.trim (TrimType.TOPLEFT);

docRef.selection.deselect ();

}

};

Kind regards

-yajiv

Tags: Photoshop

Similar Questions

  • Select the table using script

    Hello

    The threshold of all selected tables in the document. I need to select a first table, then on next table etc...

    myTable var = app.activeDocument.tables.everyItem () .getElements ();

    Someone help me?

    I am again for the script. What should I do for this type of orders InDesign as I write scripts?

    Kind regards

    Vincent

    Try this,

    var myTable = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
    alert(myTable.length)//no. of tables in a document
    for(var i=0; i
    

    Vandy

  • How to select the path to a file icon button to a table?

    I have a SYSTEM_PATHS table name. All physical access paths as 'where the forms of execution are located' or 'where performance reports are located' are stored in its ranks for example (C:\HRMS\FORMS\)
    I memorized the path of the icon files (.ico) inside. The forms of execution can take the path of the icons for the buttons of this table. And access the icon of the chosen path. I use forms 6i. Normally, I put the path of the icon files in the nerve to property of the button as (C:\HRMS\ICON\). But now, here, I don't have a path but its in the column of a table. How to select the path to a file icon button to a table using forms 6i?

    Hello Gul,

    have you tried

    set_item_property('Button name',ICON_FILENAME,);
    

    Concerning
    Marcus

  • CS6, "Select unused shades" is to select the samples used.

    In Illustrator CS6, "Select unused shades" is to select the samples used. I'm doing something wrong or is this a bug?

    I can't reproduce this in CS6 (Cloud, 16.2.1). version

    Maybe someone can check in 16.0.4 (?) so the problem can be reproduced.

    You can check if you updated to the latest version available.

  • How to get the path (using < input type = "file" / >)

    Hello world

    I create a HTML form that has an entry of type = "file".  This will give you a dialog box browse for your user to search for a file on the operating system.

    And my code:

    function handleFileSelectForMyShop (evt)
    {
    var blnFileReaderSupported = false;

    Try
    {

    Debug.log ("handleFileSelect", "start handleFileSelect");
    reader of var = new FileReader();
    blnFileReaderSupported = true;
    var files = evt.target.files;
    var size = files.length;

    Debug.log ("handleFileSelect", "handleFileSelect # selected files:" + size, debug.info);

    for (var i = 0; i)< size;="">
    {
    Debug.log ("handleFileSelect", "in the handleFileSelect analysis the index file" + i, debug.info ");
    var f = files [i];
    Reader.OnLoad = (function (theFile)
    {
    Debug.log ("handleFileSelect", "start reader.onload", debug.info);
    return Function
    {
    Debug.log ("handleFileSelect", "start Function", debug.info);

    Debug.log ("handleFileSelect", "reading file" + theFile.name + "(" + theFile.size + "") "" + theFile.type, debug.info);

    If (theFile.type.match ('image.*')) {}
    var path = e.target.result;
    alert (path);
    create the path

    } else {}
    jAlert ("Please select photo!', 'Error'");
    }
    };
    })(f);

    If ((f.type.match ('image.*')) |) (f.type.match ('audio.*')) | (f.type.match ('video.*')))
    {
    Debug.log ("handleFileSelect", "in handleFileSelect call reader.readAsDataURL for type" + f.type, debug.info);
    Read in the media file in the form of a data URL.
    reader.readAsDataURL (f);
    }
    }

    Debug.log ("handleFileSelect", "Complete", debug.info);
    }
    {} catch (e)
    Debug.log ("handleFileSelect", e, debug.exception);
    If (! blnFileReaderSupported)
    {
    Alert('Error.) The FileReader API is not supported. ") ;
    }
    }
    }

    function doPageLoad()
    {
    Try
    {
    ELE var = document.getElementById ('txtFile_staffInfo');
    If (ele)
    {
    ele.addEventListener ('change', handleFileSelectForMyShop, false);
    }
    imgSelectPictureClick = 0;
    }
    {} catch (e)
    Debug.log ("doPageLoad", e, debug.exception);
    }
    }

    window.addEventListener ("load", doPageLoad, false);

    Note: And alert (path) leads to a Base64 string! It is not a path of the image that I browse a Spain file on the operating system.

    I want to have a full path of the file. For example: file:///accounts/1000/appdata/WebWorksAppTemplate.testa3NBcHBUZW1wbGF0ZSAgICA/shared/camera/image01.jpg

    I hope to see your reply soon!

    Thank you and best regards,

    A Pham

    A Pham

    I think that you can not get the absolute path of a file due to browser security, when you use the

    It's something that you need probably a PlayBook extension for.

  • How to create a form of free paths using script?

    Hello

    I want to create a form in which I add multiple points

    I try to use GraphicLine, but it adds no way point in this

    var myGraphicLine = myPage.graphicLines.add ();

    myGraphicLine.paths.item (0).pathPoints.item (0) .anchor = [72, 72];

    myGraphicLine.paths.item (0).pathPoints.item (1) .anchor = [72, 144];

    myGraphicLine.paths.add ();

    myGraphicLine.paths.item (1).pathPoints.item (0) .anchor = [72, 144];

    myGraphicLine.paths.item (1).pathPoints.item (1) .anchor = [90, 100];

    myGraphicLine.paths.add ();

    myGraphicLine.paths.item (1).pathPoints.item (0) .anchor = [90, 100];

    myGraphicLine.paths.item (1).pathPoints.item (1) .anchor = [110, 144];

    myGraphicLine.paths.add ();

    myGraphicLine.paths.item (1).pathPoints.item (0) .anchor = [110, 144];

    myGraphicLine.paths.item (1).pathPoints.item (1) .anchor = [144, 72];

    I want to create a W shape using script type.

    How to create a form of type free paths (like those drawn with pencil or pen tools) using js?


    Thank you

    This is because you create separate ways. Create just a first, and then add all the pathpoints.

    Do not forget that all first path you create comes with free first 2 points, so just move these in the position as shown above. Then add the new points to the same path, rather than create new ones (lines #4, #8, and #12 in my example).

  • The details of the path with script

    An absolute beginner in InDesign and java script...

    With the CS6 InDesign a document already open on my PC... I can't Open file at the path and save some/all the name of files/sub-sub-sub-folders and paper route as variables with javascript?

    Path is like that: -.

    ------Server\PDFWorkflow\AdifCounty\GDS\InDesign\Adverts\225501IP.indd

    Why? I want to write a script that gives me a Place dialog box using some original path variables.

    Script dialogue place would have a path something like that: -.

    ------ServerAdifvariable\GDS\InDesign\resources\PDFWorkflow\-variable

    app.activeDocument.filePath

    Returns the path of the document. This works on recorded documents.

    If you want to make any kind of file manipulation, you should read Chapter 3 on file system access in the "JavaScript Tools Guide CS6". Launch the ESTK and open the Help menu; You'll see the document in this menu.

    Peter

  • How to select the paths with the same line width

    I would like to know how to select all the paths within a document whose line width are equal at 0.361 points

    I'd appreciate any help.

    Here you go

    #target illustrator
    
    // script.name = selectPathsThisSize.jsx;
    // script.description = selects pathItems that have the same supplied stroke width; limited to 3 decimals;
    // script.required = a document with at least one path item;
    // script.parent = CarlosCanto // 6/5/11;
    // script.elegant = false;
    
    var idoc = app.activeDocument;
    var strokewidth = prompt ("Enter Stroke Width in points of paths to be selected", 0.361, "Select Paths this size:___");
    
    for (i=0 ; i< idoc.pathItems.length; i++)
         {
              var ipath = idoc.pathItems[i];
                   if ( (ipath.strokeWidth).toFixed(3) == Number(strokewidth).toFixed(3))
                        {
                             ipath.selected = true;
                        }
         }
    
    app.redraw();
    
  • Hi, is it possible to record paths using script .jsx

    Please say a solution for the automation of the workflow because every time I have to draw the path and I need to double click on the work path and her guests for a name to save it. I am bored so I need help for this workflow as auomated manufacturing.

    Try this script. You can save it as a script and then run it in action and assign an access as F3 key. Scripts assume that the path that you want to rename is named "traced work." It also assumes that the sequence of name is the default PS: «Path 1, path 2...»

    #target photoshop
    var doc = activeDocument;
    var works = true
    try{
        var curPath = doc.pathItems.getByName ('Work Path');
        }
    catch(e){
        works = false;
        alert('There is no path named "Work Path"');
        }
    
    if(works){
        try{
            var lastPath = doc.pathItems[doc.pathItems.length-2];
            var pNum = lastPath.name.split(' ')[1];
            curPath.name = 'Path ' + (Number(pNum) + 1);
        }
        catch(e){curPath.name = 'Path 1'};
        curPath.deselect();
        }
    
  • Adding border to the text using script field

    1 can someone tell me how to add in the text field border using script.

    2. in this case, what should be the default properties for this text field.

    LiveCycle Designer version: 7.0

    Player version: 9.0

    I have

    You can try like this...

    TextField1.border.edge.presence = "visible";

    Not sure if it still works on version 7.0...

    Thank you

    Srini

  • Select the column using

    Hello

    I have a report with 4 columns, 'Year', 'Demand amount', 'Amount of the purchase order' and 'invoice amount.

    The user want to select "Amount of demand", "The purchase order amount" or "Invoice amount" in the drop down menu from the drop in the Oracle replies

    In other words, he wants to see only the year and "amount of demand."
    year or "amount in the purchase order.
    year or "amount of the invoice.

    How can I do? I already search column, select but did not understand. Please tell me in detail.

    Thank you

    Hello user.

    I advise to use the column picker in the responses.

    (1) build your table (or any other point of view) a year and the amount of the claim.
    (2) then create a view by using the choice of mode 'column selector.
    (3) check the checkbox 'Include the selector' for your column 'amount of demand. "
    (4) add the other two columns in the selection pane. Your view should look like the image below:

    ! http://i46.Tinypic.com/2gwyfso.jpg!

    5) go to your compound view and add your views 'column selector.

    You should now be able to Exchange "Amount of demand", "The purchase order amount" and "Amount of the invoice" using the column Chooser, and your other points of view should replace columns that you select.

    I hope this helps and please assign points if you found it useful!

    Kind regards
    Jason

  • How to apply the expression using script?

    I use a script and an expression to automate all the layer selected to attend the control layer. So, I've do it now in two steps, first make a layer of control using this script:

    {

    model var = app.project.activeItem;

    var slctd_layer = comp.selectedLayers;

    var new_adjustment = comp.layers.addSolid ([1,1,1], "Control", comp.width, comp.height, comp.pixelAspect, comp.duration);

    new_adjustment.adjustmentLayer = true;

    var addSlider1 = app.project.activeItem.selectedLayers [0]. Effects.addProperty ("ADBE Slider Control");

    addSlider1.name = "time";

    addSlider1.property (1) .setValueAtTime (0, 0.06);

    var addSlider2 = app.project.activeItem.selectedLayers [0]. Effects.addProperty ("ADBE Slider Control");

    addSlider2.name = "opacity";

    addSlider2.property (1) .setValueAtTime (2, 0);

    addSlider2.property (1) .setValueAtTime (2.03, 100);

    }

    Then, I select all the layer under the control and apply the expression, for example:

    delay = thisComp.layer("Controler").effect ("delay") ("Slider") * index;

    t = time + delay;

    exp = thisComp.layer("Controler").effect ("opacity")("Slider").valueAtTime (t);

    exp;

    I'm working on an animation of the tight timelines and tons of materials with tons of layer for each model now. So I think that if it is possible to combine this stage two in a script that will automate this work for me. I'm still new to scripts and none need help with it. Thank you

    Like this:

    var ease = new KeyframeEase(0,100/6);    // speed (0 for easeIn or easeOut, influence range: 0-100)
    var addSlider1 = new_adjustment.effect.addProperty("ADBE Slider Control");
    addSlider1.name = "delay";
    // 1st key: value + ease
    addSlider1.property(1).setValueAtTime(0, 0.2);
    addSlider1.property(1).setTemporalEaseAtKey(1, [ease], [ease]);
    addSlider1.property(1).setInterpolationTypeAtKey(1, KeyframeInterpolationType.LINEAR, KeyframeInterpolationType.BEZIER);
    // 2nd key: value + ease
    addSlider1.property(1).setValueAtTime(2.03, 0.03);
    addSlider1.property(1).setTemporalEaseAtKey(2, [ease], [ease]);
    addSlider1.property(1).setInterpolationTypeAtKey(2, KeyframeInterpolationType.BEZIER, KeyframeInterpolationType.LINEAR);
    

    (The use of setInterpolationTypeAtKey is not necessary, it is only there to do things similar to what you would get by doing things by hand).

    Xavier

  • Change the text using script

    I am new to scripting and still so much to learn to please bear with me. I worked on a script that will allow me to update the information of slug on the files I work with on a daily basis. I use a combination of scripting and actions on my documents that clean the documents, but aussient to fill specific information for each document. As I learn more about scripts, I could consolidate my scripts and actions.

    Currently, I am working on the selection of specific text frames based on what their note value is using this code:

    var textFrames = activeDocument.textFrames;
    
          for (var i = 0 ; i < textFrames.length; i++)
            if (textFrames[i].note == "JOBNAME") {
              var frameName = textFrames[i].contents = "JOBNAME";
        }
    
    

    Here is a small list of items I would change

    Screen Shot 2013-09-06 at 11.33.07 AM.png

    I can go about it the wrong way, but my ultimate goal is to run a script that runs through each text field, and a dialog box allows me to enter text, then it is replaced by what is entered in the field of dialogue.

    It may be easier to create a dialog box that has all the fields and allows me to enter the value for each of them, but as I said, I'm new to scripting and don't know how to do this.

    I tried to enter my slug information using variable data, with spreadsheets, but I need to convert the xml spreadsheet and I have a lot of luck with that. I found that the use of variables in illustrator can be a little tricky.

    In the end, just trying to simplify my work and make things more efficient. In the process, I would like to know as much about the scripts as I can.

    Thank you

    This should help you get started with the change of name based on the note, with the help of guests

    var textFrames = activeDocument.textFrames;
    
    for (var i = 0 ; i < textFrames.length; i++) {
        if (textFrames[i].note == "JOBNAME") {
            var jobname = prompt ("Enter JOB NAME", "Your Name", "Note Changer");
            textFrames[i].contents = jobname;
        }
    }
    
  • Select the random image script

    I create a small movie with a set of random images all appear in the same place (no horizontal or vertical movement). I want each image displayed on the screen for two seconds, then replaced by another image selected at random. There are 17 images in the game. Here is the script I use:

    on enterFrame

    Channel = Random (17)

    _movie. Delay(2*60)

    on exitFrame

    go to the section

    end

    This script works well. However, because the population is small - only 17 - what happens when I run the script is that too often it selects at random the same image once, twice, sometimes up to five times in a row, giving the effect that the film is either stuck or does not properly. I would like to know how to change the script so that on exitFrame it randomly chooses a 16 other pictures but not the current image. At first I thought that if the script read random (16) or random(17-1) that could work, but it doesn't.

    Any thoughts would be welcome.

    Dallas

    Start by adding a script for frameScript channel which stops at the head of this frame. The script that I have provided above should then do the rest.

  • How to measure the distance using script

    Hello

    Is it possible to measure the distance of any document in photoshop using the measure tool, using the script. Below the steps required by me. Hope I'm clear in my communications.

    I've searched the forums, but couldn't find appropriate answers.

    1. open the Photoshop document

    2. allow the user to draw the line with measure tool

    3. the alert distance

    RGS

    Anish

    This only works with CS5 because it now uses the tool instead of a path rule. But it solves all the problems talked about in this thread and many other differences between the original function and the data in the info panel.

    It returns a custom with angle and length properties object if there is a rule tool line in the active document and not of the indefinite. I didn't know if the length must be a unitValue or number in the units of the rule settings. I went with number because the Panel info has different number of decimal places for the different units. And as the Panel assigned the corresponding graduation info per cent the length value is empty

    function getRulerToolLengthAndAngle() {}

    points of var = [];

    points. Start = [];

    points. End = [];

    var / / desc = new ActionDescriptor();

    Var ref = new ActionReference();

    ref.putProperty (charIDToTypeID ('Rprp'), charIDToTypeID ("RrPt"));

    ref.putEnumerated (charIDToTypeID ('Dcmn'), charIDToTypeID ('Ordn'), charIDToTypeID ('Trgt'));

    desc.putReference (charIDToTypeID ('null'), ref);

    var / / desc = executeAction (charIDToTypeID ('getd'), desc, DialogModes.NO);

    If (desc.hasKey (charIDToTypeID ('points'))) {}

    pointList var = desc.getList (charIDToTypeID ('points'));

    var startPointDesc = pointList.getObjectValue (0);

    points. Start.push (startPointDesc.getUnitDoubleValue (charIDToTypeID ('X')));

    points. Start.push (startPointDesc.getUnitDoubleValue (charIDToTypeID ('Y')));

    var endPointDesc = pointList.getObjectValue (2);

    points.end.push (endPointDesc.getUnitDoubleValue (charIDToTypeID ('X')));

    points.end.push (endPointDesc.getUnitDoubleValue (charIDToTypeID ('Y')));

    var RES = {};

    res.toString = function() {return "RulerTool news" ;};}

    Pointed var = points.start;

    var points.end = b;

    If (pointed [0]

    var a = Math.max(pointA[0],pointB[0]) - Math.min (pointed [0], b [0]);

    var o = Math.max(pointA[1],pointB[1]) - Math.min (pointed [1], b [1]);

    var ang = (180/Math.PI) * Math.atan2(o,a);

    If (pointed [1]< pointb[1]){//negative="">

    Ang = - ang;

    };

    Res.angle = ang.toFixed (1);

    } else {}

    var a = Math.max(pointA[1],pointB[1]) - Math.min (pointed [1], b [1]);

    var o = Math.max(pointA[0],pointB[0]) - Math.min (pointed [0], b [0]);

    var = 180-((180/Math.PI) Ang * Math.atan2 (a, o));

    If (pointed [1]< pointb[1]){//negative="">

    Ang = - ang;

    };

    Res.angle = ang.toFixed (1);

    }

    If (app.preferences.rulerUnits == Units.PERCENT) {}

    Res. Length = "";

    } else {}

    var c = Math.sqrt + ((a*a) (o * o));

    var length = new UnitValue (c, 'px');

    length.baseUnit = new UnitValue((1/app.activeDocument.resolution),'in');

    Switch (app.preferences.rulerUnits) {}

    case Units.PIXELS: res.length = length.as('px').toFixed (2); break;

    case Units.INCHES: res.length = length.as('in').toFixed (3); break;

    case Units.CM: res.length = length.as('cm').toFixed (2); break;

    case Units.MM: res.length = length.as('mm').toFixed (1); break;

    case Units.POINTS: res.length = length.as('pt').toFixed (1); break;

    case Units.PICAS: res.length = length.as('pc').toFixed (2); break;

    }

    }

    return res;

    }

    }

    var getRulerToolLengthAndAngle() = Info;

    If (info! = undefined) alert (' the ruler tool angle is: ' + info.angle +'\nThe length is: ' + info.length);

Maybe you are looking for