Help with a Script to remove the additional paths and save

Here are a few scripts that I have at the moment, but none work. With the first script, I get an error with the 'indexOf', and with the second script, it keeps only the second name listed in the string. How can I get either of these to work where I can remove all the paths, with the exception of multiple ones I want to keep?

function deletepaths()
{
  if (!documents.length) return false;


  var doc = activeDocument;
  var save = ["Ex1", "Ex2", "Ex3"];


  for (var x = 0; x < doc.pathItems.length; x++)
  {
    if (save.indexOf(doc.pathItems[x].name) == -1))
    {
      doc.pathItems[x].remove();
    }
  }
}
deletepaths();

deletepaths();
function deletepaths(){
if(!documents.length) return;
var doc = activeDocument;
for(var a = doc.pathItems.length-1;a>-1;a--){
if(doc.pathItems[a].name != ("ex1", "Ex2")) 
     doc.pathItems[a].remove();
  }
}

IndexOf does not work with extension script. Most likely, you would need a number if statement for many golds ' | ', or a loop in the loop goes well your path names.

Tags: Photoshop

Similar Questions

  • Help with a script to remove the link "Place and link" content

    Hello

    I need a script that will separate the content that has been placed in an indesign document by using the feature "place and link.

    I know I can manually go to the link Panel, select the linked content here and click 'remove link' in the Panel menu. However, I have about 200 indesign documents that are all full of content that has been 'placed and connected '. One I get a script to unlink content, I can add it to a batch routine to make the record of 200.

    Can anyone help please.

    See you soon

    Like this?

    app.activeDocument.links.everyItem () .unlink ();

  • Need help with custom script to rename the layers

    Hello world.

    I need help to write a custom script (because I suck at it) that will allow me to go through all the layers and sous-calques for a specific name ('X') and give it a new specific name ('Y').

    I have had success using the script below, but it does not work on any text layers names where the text layer was previously particularly well-known in 'X' and now changed needs.

    Any help is greatly appreciated.

    * Note: this script was originally used to find any layer with 'Copy' in its name and remove with anything after (to correct the problem of duplication of layers by adding this text).

    This is why the function is named removeCopy. It works for renaming layers also - just not a layer of text unfortunately.

    #target illustrator

    function removeCopy() {}
    If (app.documents.length == 0) return;
    var app.activeDocument = docRef;
    recurseLayers (docRef.layers);
    }
    removeCopy();
    function recurseLayers (objArray) {}
    for (var i = 0; i < objArray.length; i ++) {}
    ObjArr [i] .name = ObjArr [i].name.replace (/ \s*current name\s*\d*/, 'new name');
    If (objArray [i] .layers) recurseLayers (. layers.length > 0 ObjArr [i]);
    }
    }

    I finally found something after searching forums for a week. My confusion was related to the way Illustrator treats real layers against text/path/object "layers." Instead of layers, I had to use the pageItems in the script. The code below works. Thanks to Gustavo for his answer in another thread and Carlos I thank you for this looking too good! You're great to be ready to help models do more advanced things with Illustrator.

    var doc = app.activeDocument;
    var items = doc.pageItems;
    for (var g = 0; g)
        elements [g] .name = elements [g].name.replace ('Century Schoolbook text line', ' MonogramText: Century Schoolbook ");
    };
    App.Redraw ();
  • Help with a script that converts the HTML object text box

    I don't know anything about programming scripts and unfortunately inDesign isn't any panel actions as Photoshop..

    I need a script to convert a text box with HTML code inside a HTML object... I think not, it should be very difficult

    How could be the following:

    (1) select the text box
    (2) cut all text inside
    (3) remove the empty box
    (4) select selection tool
    (5) go to OBJECT/INSERT HTML
    6) paste it into the code before you cut the text box
    (7) OK and close the menu INSERT HTML code

    If the Script works, we could change with HTML code inside a text box to an object HTML (video, card, animations,...)

    The first step could be manually selecting each text box or by selecting all of the boxes that start automatically by "< iFRAME '

    1000 thanks

    Remember that you can not get an answer it if you don't show any attempt of your choice.

    FWIW

    Loïc

  • Girls need help with a script to repeat the link to another folder in indesign

    I REALLY hope you smart people can help me.

    We had servers which means that all of our Indesign documents now have a broken link. To manually "re-edit the link to the file" causes Indesign down :-(. And it takes forever I am hoping to find a script that can connect all the links in the doc to a new file structure.

    The name of the link (name of file) and the file structure remains the same; Just point to another server. The structure contains subfolders so the best way would be that the script can see subfolders as well, but otherwise I would gladly use a script that points of 6 subfolders at a time.

    Problem - I KNOW NOT ALL SCRIPTS and I'm a graphic designer so I can't create scripts :-(. I have already had success Googling a script to unlink everything in the document, but I don't know how to run the script. DO NOT to create them.

    ANY help in this forum? I have 6 designers waiting for me to fix this.

    Is there a script where I could just change the path and then he could repeat?

    We have iMac OSX Yosemite 10.10.4

    PLEASE HELP... :-)

    / Dina

    Try this... it is created by Vamitul

    main() {} function

    var doc = app.activeDocument;

    myLinks var = doc.links.everyItem () .getElements ();

    var linkObj = {};

    Create the initial object

    / * {linkObject

    [path] {missingNr,

    arrayOfMissingLinks}

    } */

    for (var i = 0; i)< mylinks.length;="" i++)="">

    If (myLinks [i] .status == LinkStatus.LINK_MISSING) {}

    var myPath = File(myLinks[i].filePath).path.toString ();

    If (linkObj [myPath] == undefined) {}

    linkObj [myPath] = {}

    missingNr: 1.

    missingLinks: [myLinks [i]],.

    newPath: "

    }

    } else {}

    linkObj [myPath] .missingNr ++;

    linkObj [myPath].missingLinks.push (myLinks [i] .getElements () [0]);

    }

    }

    }

    $.writeln (linkObj.toSource ());

    var myDialog = new window ("dialog", "link Chaser:', undefined");

    Panel1 = myDialog.add var ('panel', undefined, "double-click to select the new path '");

    Panel1. Align = ["fill",""];

    myList var = panel1.add ("listBox", undefined, "", {})

    columnWidths: [160, 160, 130],

    numberOfColumns: 3,.

    showHeaders: true,

    columnTitles: ['old road', 'New Path', 'Nr. missing links']

    });

    myList.size = [450, 200];

    myList.align = ["fill",""];

    for {(var missingPath in linkObj)

    with (myList.add ("item", missingPath)) {}

    Subitems [0] .text is linkObj [missingPath] .newPath;.

    Paragraphs [1] .text is linkObj [missingPath] .missingNr;.

    }

    }

    myList.onDoubleClick = function() {}

    var myNewPath = (new folder (app.activeDocument.filePath) .selectDlg ("Select New Folder") |. toString() ' ");

    myList.selection.subItems [0] .text = myNewPath;

    linkObj [myList.selection.text] .newPath = myNewPath;

    }

    myDialog.add ('button', {undefined, "Ok",

    name: 'ok '.

    });

    myDialog.add ("button", undefined, "Cancel", {})

    name: "Cancel".

    });

    If (myDialog.show () == 1) {}

    for (var i in linkObj) {}

    If (linkObj [i] .newPath! = ") {}

    var fixedNr = 0;

    Var links = linkObj [i] .missingLinks

    for (var j = 0; j)< links.length;="" j++)="">

    var queue = newFile (linkObj [i] .newPath + "/" + links [j] .name);

    If {(newFile.exists)

    fixedNr ++;

    Links [j] .relink (NewFile);

    }

    }

    Alert ("in the folder: \n" + linkObj [i] .newPath + '\n' +)

    'Fixed' fixedNr ' links of ' + linkObj [i] .missingNr + '\n ' +.

    "Please check");

    }

    }

    };

    }

    app.doScript ('main()', undefined, undefined, UndoModes.entireScript, "Chaser link");

  • Help with a script that detects the content in a cell and apply the cell style to line

    Hello


    I am trying to add an article to my table formatting script that is a cell with the word 'Budget' (but this can be written as ' Budget:' or ' Budget: (E) "- but without the speech marks) and apply the cell Style - SponsorCells - to all the cells of the whole line. I currently have on what it will, but it does not work:


    function checkWhichTable()
    {
    // ensure the user made a selection
    if (app.selection.length != 1)
    return null;
    var currentTable = app.selection[0];
    if (currentTable.hasOwnProperty("baseline"))
    {
    currentTable = app.selection[0].parent;
    }
    while (currentTable instanceof Cell || currentTable instanceof Row || currentTable instanceof Column)
    currentTable = currentTable.parent;
    if (!(currentTable instanceof Table))
    {
    // No table selected
    return null;
    }
    return currentTable;
    }
    app.doScript(checkUserSelection, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Process Table");
    
    
    function checkUserSelection ()
    {
    var a_table = checkWhichTable();
    if (a_table == null)
    {
    if (confirm("No table selected. Do you want to process *all* tables?") == false)
    return;
    allTables = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
    for (aTable=0; aTable<allTables.length; aTable++)
    {
    processTable (allTables[aTable]);
    }
    } else
    {
    processTable (a_table);
    }
    }
    function processTable(table)
    {
    // do something here!
    
    
    //Set 1st Row Height
    table.rows[0].height = "30mm";
    
    
    //Find Text in Cell and apply Cell Style to Row 
    var  
      myCellText=['Budget', 'Budget:', 'Budget: (E)'];  
     var myRegEx = new RegExp("^("+myCellText.join("|")+")$");
      for (i=0; i<table.cells.length; i++)
      {
        if (table.cells[i].texts[0].contents.match(myRegEx))
          table.cell[i].appliedCellStyle = "SponsorCells";
      }
    
    
    //end - do something here!
    }  
    


    I can get the script to apply the cell style to "SponsorCells" for each cell that contain the word 'Budget' etc, but I need cell ever on this line to have the cell style applied. I tried to re-write line 56 which applies the style to a cell, but I can't seem to make it work. Any help would be great.


    Separate on this issue, I would like to have a line of code similar to the 46 line, which sets the 1st height of lines, but I would like to say "If a cell has 'A cell Style' and then applies the value height 10 mm". If someone could result as a help of bonuses, things would be great double.


    Thanks in advance!

    But that could be painfully slow. To speed things up, follow these steps:

    var cells = table.cells.everyItem().getElements();
    for (var i=0; i
    

    It is faster, because it creates an array of cells with a call to table.cells, which is several times faster than calling table.cells. And before assigning to line 12mm height is useful to check if it is already 12 mm. checking things in InDesign and do things only when it is necessary is much more effective than simply doing things even if they are not necessary.

  • When I edit a .wav file (noise reduction to remove the background hiss) and save them, the changes are not saved.

    I just installed hearing and have edited a few audio voiceover to remove the background hiss.  When I save the changes and reopen the file, the hiss is back.  The changes are not saved.  Why is this happening?  How to record the sound of the effects of reduction in my .wav file?

    [Ask in the correct forum allows... Left generic Cloud/Setup forum for forum specific program... MOD]

    shionak wrote:

    I capture the background hissing noise footprint > click apply > click on select, then click on apply again.

    These steps are not quite correct. You have two choices; either highlight a part of the background noise and use SHIFT + P, which captures your selection as a basis for NR or, open the Panel NR and use "Capture noise Print" from there, after making a selection first. After doing this, click on "select an entire file. What you definitely have to do is to use 'apply' at this point, and when use you it, just use it once.

    When you capture using printed, the Preview 'play' button inside the plugin to check the settings and then stop it. When you are satisfied of what he done, then click on 'Apply' - but once. This will apply for all of your noise reduction. As long as you do not use "undo" at any time, the version Number will be be recorded on the original, or if you use "save under", then the original will be left alone, and a new noise-reduced version will be saved.

  • I have synced to move them all to a new computer, but after that I moved with success, when I removed the old one and I forgot to cancel the synchronization it cleaned my other.

    I moved successfully my info, Favorites, etc., for a new laptop computer with synchronization, but when I cleaned all my info from my old internet computer to offshore and forgot to cancel synchronization, and then synchronized and cleaned my other. Help! Can I get my favorites and other things back?

    I understand very well and it is difficult for me to say, but you can't get anything back - because there is that nothing more, at least not on Mozilla servers.

  • Help with 3-d positioning using the z (forward and backward)

    I have several compositions nested in my project OVER a good bit of photoshop layers. I notice every time I post my layers/pre-comps using the z axis in my main composition (forward and back) I can't say if they are all using the front view, I can only say that she was moved when he disappears behind another layer. HOWEVER when I go the main composition that contains all of the items, I can see how it looks 'really' in rendered previews, as if all of a sudden I see exactly where I placed the layers, and it is really misplaced. Why can I not see this before I go? And why didn't he show me this point of view in the first place?

    FYI: I see the side/top view layers, but I does not help me much because I can't tell what the front looks like.

    Thanks for a quick response! I thought about it, the answer is very simple: I do not have the 'Active camera view', which would have enabled to see exactly how I was positioning my diapers. I got it on the 'front'. When the "façade" is actually useful?

  • Remove the delicious Sidebar and save icon

    After my upgrade to FF30 yesterday (it was also a nightmare), FF open with a delicious sidebar and it also put an icon 'save' to the right of my search bar.

    I have no bloody idea whence they came, I do not use Delicious, do not have over the years.

    Before FF30, none of them anywhere to be found.

    How can I remove them?

    Is not a toolbar of Delicious, I repeat, is not a toolbar which can be removed via Add/Remove Windows, nor do I have any of the delicious module.

    I've seen these instructions, they are not relevant.

    I don't have automatic updates to any software, even Windows updates not, I run Firefox in Sandboxie with some permissions, this has not got by me or Sandboxie, it appeared as if by magic with FF30 somehow.

    Where did this side bar and the icon come from?

    If it is a new combination of Firefox-Delicious, she, like everything else since FF20 +, is a hunting witch who becomes tedious.

    Can someone point me to a solution please?

    Thank you, in advance.

    Close, get you me on the right track, however.

    It is listed as a "service" under modules, now deleted, problem solved.

    I have no idea how it got there.

    Thank you...

  • How to solve "Download error" not corrected by removing the files AAMUpdater and OOBE

    Hello

    I spent several hours today to try to fix the access to my CC apps for photographers (LR and PS), without result. Initially, everything worked fine until I was logged in as administrator, but trying to use creative cloud as a standard user on my laptop, I get a "Download error" message in the part CC App, inviting me to "Reload request" which of course does not work. I searched on the Internet and various forums on how to do this and found a page on the Adobe site help who instructed me to remove the AAMUpdater files and OOBE in the Adobe User-specific directory into account, I did (it took me a while to understand how, because first I could not remove the OOBE folder). Once I had done that, and after you disable my Norton Internet Security and MalwareBytes protections, I restarted the desktop application Cloud Creative, logged into my account and hope to find my LR and PS Apps that I know are on my computer, since I had them used in the Admin session, with no success. The same error message ""Download error"/"Reload the application"is displayed, and by clicking on the button reload the Application has no effect.» I'm really weary about this, more so than at the same time, I have the same problem when you sign in as an administrator. If nothing works anymore. Help, please! Moreover, I tried to start a conversation with the assistance of Adobe service, got a number, but then nothing happened.

    Please visit: FAQ: what should I do if I have a subscription, but my application acts as if I had a trial?

    If you have tried all of these suggestions, please contact support for assistance:

    FAQ: How to contact Adobe for support?

  • Are required to report the VM path and the full path of the friendly help LUN ID .vmx file

    Hello

    Came across Luke script to the data store and vm path list:

    Get - VM | Get-View | %{

    $row = "" | Select the name, the data store, path

    $row. Name = $_. Name

    $row. Data store = (Get-view $_.) Datastore [0]). Summary.Name

    $current = get-view $_. Parent

    $path = $_. Name

    {}

    $parent = $current

    if($parent.) Name - only "vm") {$path = $parent. {Name + "\" + $path}

    $current is get-view $current. Parent

    } While ($current. Parent - no $null)

    $row. Path = $path

    $report += $row

    }

    $report | Export-Csv $CsvFile - NoTypeInformation

    I need help modify this script to display the full path of the vmx file

    Thank you

    Is that what you mean?

    Get-VM | Get-View | % {
         $row = "" | select Name, Datastore, Path, VMXPath
         $row.Name = $_.Name
         $row.Datastore = (Get-View $_.Datastore[0]).Summary.Name
         $current = Get-View $_.Parent
         $path = $_.Name
         do {
              $parent = $current
              if($parent.Name -ne "vm"){$path = $parent.Name + "\" + $path}
              $current = Get-View $current.Parent
         } while ($current.Parent -ne $null)
         $row.Path = $path
         $row.VMXPath = $_.Config.Files.VmPathName
         $report += $row
    }
    $report | Export-Csv $CsvFile -NoTypeInformation
    
  • I need script to remove the line with 2 points, another script to remove next lines

    I need script to remove the line with 2 points, another script to remove next lines of two scripts needed help please

    Thanks in advance

    Concerning

    Lakshmiganth

    Scroll through each pathitem and look at the length of his pathPoints group.  If the length is equal to 2 and then use the remove() method to remove it.  For example (this is rough, off the top of my head):

    var lines = new Array();

    for (i = 0;  I have< app.activedocument.pathitems.length; ="" i++)="">

    If (app.activeDocument.pathItems [i].pathPoints.length == 2) {}

    Lines.push (App.activeDocument.pathItems [i]);

    }

    }

    for (i = 0;  I have< lines.length; ="" i++)="">

    Lines [i]. Remove();

    }

  • Need help with a script (o - o8) *, see the Virgin if there is no

    Hi all what I need help with a script I can't find an example.

    I'm trying to subtract 2 numbers and then multiply this product. (o o8) * one but I just want to do the calculations if all fields have the numbers IE field o, o8 of field and field one.

    Thank you in advance. I was stuck on this days searching the Internet.

    Assuming you want to affect the outcome of this calculation in another text field, use this code as a custom field calculation script:

    var o = this.getField("o").valueAsString;
    var o8 = this.getField("o8").valueAsString;
    var a = this.getField("a").valueAsString;
    if (o!="" && o8!="" && a!="") event.value = (Number(o)-Number(o8))*Number(a);
    else event.value = "";
    
  • If I go to your stand at the NEC photographic show (21-24 March) can I expect to get personal help with using of items 13 - esp. vertical correction and the addition of sky to architects plans?

    If I go to your stand at the NEC photographic show (21-24 March) can I expect to get personal help with using of items 13 - esp. vertical correction and the addition of sky to architects plans?

    No, but Adobe offers a discount on the price of admission to the entire show. Adobe seminar room will be back this year yet, but are of demonstrations and public seminars. A number of speakers UK will be available, but the emphasis is on creative cloud, Lightroom and Photoshop CC.

    http://blogs.Adobe.com/richardcurtis/?p=4100

Maybe you are looking for

  • Sync iPhone to Mac causes repeated imports

    several photos and a short video which get re-imported whenever I have plug into my MacBook Pro. I have now about 30 copies of each. Except that everything works fine. All is up to date and running smoothly.

  • I can't download adobe Flash Player, no noise, no code javascript

    I have I have no sound, I can't download adobe Flash Player? and no sevice pack isn't settings it's off or?

  • Do I need as many files C++ Redistributable installed?

    I have 7 2008 Redistributable C++ and C++ 2005 installed 5 programs. Should this system really these programs and can I just uninstall? It would affect the operation of my Vista operating system?

  • Wag54g, wirelless covrage ADSL

    Hello Please pay attention to the image; It might the ADSL modem wireless + cover (e.g., WAG54G) AP, the wireless adapter.If the answer is negative, then if both (wireless modem) & wireless adapter, close the window, how?Once again, if the answer is

  • Why are they not icons and files in the windows folder

    No matter what folder/window that opens like the Control Panel, documents folder opens but is a blank window.  No icons or files.  Programs and files are all there, but could not get to them from any window.  Why windows appear white?