How to move the ends of the lines slanted towards the limits of the purge

Hi all

I developed a script that deletes the page elements to the purge. To achieve this, that I collect all the elements of the page (with the exception of text blocks) located partially on the editing table, create a temporary mask and 'trim' with subtraction of Pathfinder function. However, this approach does not work with graphic lines so I'm trying to move the ends of the lines to the limits of the substantive area lost. (I guess these are simple straight lines consisting of two end points).

screengrab.png

I knew how to deal with orthogonal lines - it's pretty easy:

if (theItem.constructor.name == "GraphicLine" && theItem.paths.length === 1) {
     path = theItem.paths[0];
     if (path.pathPoints.length === 2) {
          ep = path.entirePath;
          w = ep[1][0]-ep[0][0];
          h = ep[1][1]-ep[0 ][1];
          
          if (w > h) {
               newEp = [ [ spreadWithBleedBounds[1], ep[0][1] ], [ spreadWithBleedBounds[3], ep[1][1] ] ];
               path.entirePath = newEp;
          }
          else if (h > w) {
               newEp = [ [ ep[0][0], spreadWithBleedBounds[0] ], [ ep[1][0], spreadWithBleedBounds[2] ] ];
               path.entirePath = newEp;
          }
     }
}

This moves A1 - A2, B1 , B2, C1 , C2, D1 to D2.

But how to treat skewed lines? How to calculate the coordinates of the point E2 and F2? Y at - it a magic formula? Or can someone point me to the right direction: for example a book to read?

I assume this has something to do with geometry/trigonometry, but I haven't studied this kind of things at school. (I graduated from an art school - designed to draw naked models instead).

If someone will answer my question, please do it on basic level since I'm a total noob in the present.

Here's the script:

if (Number(String(app.version).split(".")[0]) == 7) ErrorExit("This script can't work with InDesign CS5 so far.", true);

var doc = app.activeDocument;
var spreadBounds, spreadWithBleedBounds, gPartiallyOutOfSpreadItems;
var ungroupErrors = 0;

var originalHorUnits =  doc.viewPreferences.horizontalMeasurementUnits;
var originalVerUnits =  doc.viewPreferences.verticalMeasurementUnits;
doc.viewPreferences.horizontalMeasurementUnits = doc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.INCHES;
doc.viewPreferences.rulerOrigin = RulerOrigin.spreadOrigin;
doc.zeroPoint = [0, 0];

if (doc.layers.itemByName("Temporary Layer") == null ) {
     var tempLayer = doc.layers.add({name:"Temporary Layer"});
}
else {
     var tempLayer = doc.layers.itemByName("Temporary Layer");
}

UngroupAllGroups(doc.groups);

DeleteObjectsOnPasteboard();
ProcessSpreads(doc.spreads);
ProcessSpreads(doc.masterSpreads);

tempLayer.remove();

doc.viewPreferences.horizontalMeasurementUnits = originalHorUnits;
doc.viewPreferences.verticalMeasurementUnits = originalVerUnits;

var msg = (ungroupErrors > 0) ? " Failed to ungroup " + ungroupErrors + " groups since they are too large." : "";
alert("Done." + msg, "Trim Pages Script");

//================================== FUNCTONS ===========================================
function ProcessSpreads(spreads) {
     var spread, path, ep, w, h;
     for (var s = 0; s < spreads.length; s++) {
          spread = spreads[s];
          spreadBounds = GetSpreadBound(spread, false);
          spreadWithBleedBounds = GetSpreadBound(spread, true);
          
          gPartiallyOutOfSpreadItems = GetPartiallyOutOfSpreadItems(spread);
          
          var theItem, theMask, newItem;
          for (var i = gPartiallyOutOfSpreadItems.length-1; i >= 0; i--) {
               theItem = gPartiallyOutOfSpreadItems[i];
               if (theItem.constructor.name == "GraphicLine" && theItem.paths.length === 1) {
                    path = theItem.paths[0];
                    if (path.pathPoints.length === 2) {
                         ep = path.entirePath;
                         w = ep[1][0]-ep[0][0];
                         h = ep[1][1]-ep[0 ][1];
                         
                         if (w > h) {
                              newEp = [ [ spreadWithBleedBounds[1], ep[0][1] ], [ spreadWithBleedBounds[3], ep[1][1] ] ];
                              path.entirePath = newEp;
                         }
                         else if (h > w) {
                              newEp = [ [ ep[0][0], spreadWithBleedBounds[0] ], [ ep[1][0], spreadWithBleedBounds[2] ] ];
                              path.entirePath = newEp;
                         }
                    }
               }
               else {
                    theMask = CreateMask(spread);
                    try {
                         newItem = theMask.subtractPath(theItem);
                    }
                    catch (err) {
                         $.writeln("2 - " + err);
                         theMask.remove();
                    }
               }
          }
     }
}
//--------------------------------------------------------------------------------------------------------------
function IsPartiallyOutOfSpread(pageItem) {
     var result = false;
     if (pageItem.constructor.name == "TextFrame" ||
          pageItem.constructor.name == "Group" ||
          pageItem.parent.constructor.name == "Group")
     {
          return result;
     }

     var visBounds = pageItem.visibleBounds;
     if (visBounds[0] < spreadBounds[0] && visBounds[2] > spreadBounds[0] ||
          visBounds[1] < spreadBounds[1] && visBounds[3] > spreadBounds[1] ||
          visBounds[2] > spreadBounds[2] && visBounds[0] < spreadBounds[2] ||
          visBounds[3] > spreadBounds[3] && visBounds[1] < spreadBounds[3]  ) {
          result = true;
     }
     return result;
}
//--------------------------------------------------------------------------------------------------------------
function GetSpreadBound(spread, bleed) { // including bleed -boolean
     if (bleed == undefined) bleed = false;
     
     with (doc.documentPreferences) {
          var topBleed = documentBleedTopOffset
          var leftBleed = documentBleedInsideOrLeftOffset;
          var bottomBleed = documentBleedBottomOffset;
          var rightBleed = documentBleedOutsideOrRightOffset;
     }

     var bFirst = spread.pages.item(0).bounds; // bounds of the first page
     var bLast = spread.pages.item(-1).bounds; // bounds of the last page
     return [     ((bleed) ? bFirst[0]-topBleed : bFirst[0]), 
                    ((bleed) ? bFirst[1]-leftBleed : bFirst[1]), 
                    ((bleed) ? bLast[2]+bottomBleed : bFirst[2]), 
                    ((bleed) ? bLast[3]+rightBleed : bLast[3])
                    ];
}
//--------------------------------------------------------------------------------------------------------------
function CreateMask(spread) {
     var unitValue = new UnitValue (app.pasteboardPreferences.minimumSpaceAboveAndBelow, "mm");
     var unitValueAsInch = unitValue.as("in");
     var outerRectangleBounds = [spreadWithBleedBounds[0]-unitValueAsInch, 
                                                            spreadWithBleedBounds[1]-8.07, 
                                                            spreadWithBleedBounds[2]+unitValueAsInch, 
                                                            spreadWithBleedBounds[3]+8.07
                                                            ]; 

     var outerRectangle = spread.rectangles.add(tempLayer, undefined, undefined, {geometricBounds:outerRectangleBounds});
     var innerRectangle = spread.rectangles.add(tempLayer, undefined, undefined, {geometricBounds:spreadWithBleedBounds, fillColor:doc.swatches.item("Black"), fillTint:30});
     var mask = outerRectangle.excludeOverlapPath(innerRectangle);
     return mask;
}
//--------------------------------------------------------------------------------------------------------------
function GetPartiallyOutOfSpreadItems(spread) {
     var allPageItems = spread.allPageItems;
     var partiallyOutOfSpreadItems = [];
     var currentItem;
     
     for (var i = 0; i < allPageItems.length; i++) {
          currentItem = allPageItems[i];
          if (IsPartiallyOutOfSpread(currentItem)) partiallyOutOfSpreadItems.push(currentItem);
     }
     
     return partiallyOutOfSpreadItems;
}
//--------------------------------------------------------------------------------------------------------------
function DeleteObjectsOnPasteboard() {
     var objs = app.documents[0].pageItems.everyItem().getElements();
     while (obj=objs.pop()) {
          try {
               if(obj.parent instanceof Spread || obj.parent instanceof MasterSpread){ obj.remove() }
          }
          catch(err) {
               //$.writeln("2 - " + err);
          }
     }
}
//--------------------------------------------------------------------------------------------------------------
function ErrorExit(myMessage, myIcon) {
     alert(myMessage, "Trim Pages Script", myIcon);
     exit();
}
//--------------------------------------------------------------------------------------------------------------
function UngroupAllGroups(groups) {
     for (var i = groups.length-1; i >= 0; i--) {
          var gr = groups[i];
          if (gr.groups.length > 0) {
               var subGroups = [];
               for (var j = gr.groups.length-1; j >= 0; j--) {
                    subGroups.push(gr.groups[j].id);
               }                    
               try {
                    gr.ungroup();
               }
               catch(err) {
                    //$.writeln("1 - " + err);
                    ungroupErrors++;
               }
          
               for (var k = subGroups.length-1; k >= 0; k--) {
                    try {
                         doc.groups.itemByID(subGroups[k]).ungroup();
                    }
                    catch(err) {
                         //$.writeln("2 - " + err);
                         ungroupErrors++;
                    }
               }
          }
          else {
               try {
                    gr.ungroup();
               }
               catch(err) {
                    //$.writeln("1 - " + err);
                    ungroupErrors++;
               }
          }
     }     
}
//--------------------------------------------------------------------------------------------------------------

Thanks in advance.

Kasyan

Hi Kasyan!

I was not trying to integrate this into your script, so you may need to adjust a little. The trick is to define a function that detects the point of intersection of two lines - and, of course, you must call it for lines that will not fail to cross the border of the page! (Otherwise, it would simply expand * any * the line upward and on the border.)

I think it would be wise to predict a small mistake for lines that seem to run "up to" the edge of the page - I tested a line for 'x '.<= 0"="" on="" a="" line="" that="" appeared="" to="" start="" on="" 0;="" the="" control="" panel="" told="" me="" so.="" however,="" i="" didn't="" type="" that="" 0="" in;="" i="" dragged="" the="" line="" to="" the="" edge.="" apparently,="" it="" was="" *not*="" at="" precisely="" "0mm",="" but="" something="" like="" "0.001mm",="" because="" the="" script="" simply="" didn't="" "see"="" the="">

My function comes from this page: http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/ and I did not test it does of orthogonal lines

(but of course, you could add this in exceptional cases), and it's my script extending the line, with a small wrapper to configure things.

The function tests * any * tail against * any * other line, so if we meet the page bounding box, I get the intersection with the purge of the side area where it crosses the bbox page.

line = app.selection[0];
// pg size in "regular" [y1,x1, y2,x2] format
pagebbox = [0,0, app.activeDocument.documentPreferences.pageHeight,app.activeDocument.documentPreferences.pageWidth ];
bleedDist = 5; //
bleedbbox = [ pagebbox[0] - bleedDist, pagebbox[1] - bleedDist, pagebbox[2] + bleedDist, pagebbox[3] + bleedDist ];
pt1 = line.paths[0].pathPoints[0].anchor;
pt2 = line.paths[0].pathPoints.lastItem().anchor;
// Start point:
if (pt1[0] <= pagebbox[1] || pt1[0] >= pagebbox[3] ||
 pt1[1] <= pagebbox[0] || pt1[1] >= pagebbox[2])
{
 if (pt1[0] <= pagebbox[1])
  intersectPt = IntersectionPt ( [pt1, pt2], [ [ bleedbbox[1], bleedbbox[0]], [bleedbbox[1], bleedbbox[2] ] ] );

 if (pt1[0] >= pagebbox[3])
  intersectPt = IntersectionPt ( [pt1, pt2], [ [ bleedbbox[3], bleedbbox[0]], [bleedbbox[3], bleedbbox[2] ] ] );

 if (pt1[1] <= pagebbox[0])
  intersectPt = IntersectionPt ( [pt1, pt2], [ [ bleedbbox[1], bleedbbox[0]], [bleedbbox[3], bleedbbox[0] ] ] );
 if (pt1[1] >= pagebbox[2])
  intersectPt = IntersectionPt ( [pt1, pt2], [ [ bleedbbox[1], bleedbbox[2]], [bleedbbox[3], bleedbbox[2] ] ] );
 line.paths[0].pathPoints[0].anchor = intersectPt;
}
// End point:
if (pt2[0] <= pagebbox[1] || pt2[0] >= pagebbox[3] ||
 pt2[1] <= pagebbox[0] || pt2[1] >= pagebbox[2])
{
 if (pt2[0] <= pagebbox[1])
  intersectPt = IntersectionPt ( [pt1, pt2], [ [ bleedbbox[1], bleedbbox[0]], [bleedbbox[1], bleedbbox[2] ] ] );

 if (pt2[0] >= pagebbox[3])
  intersectPt = IntersectionPt ( [pt1, pt2], [ [ bleedbbox[3], bleedbbox[0]], [bleedbbox[3], bleedbbox[2] ] ] );

 if (pt2[1] <= pagebbox[0])
  intersectPt = IntersectionPt ( [pt1, pt2], [ [ bleedbbox[1], bleedbbox[0]], [bleedbbox[3], bleedbbox[0] ] ] );
 if (pt2[1] >= pagebbox[2])
  intersectPt = IntersectionPt ( [pt1, pt2], [ [ bleedbbox[1], bleedbbox[2]], [bleedbbox[3], bleedbbox[2] ] ] );
 line.paths[0].pathPoints.lastItem().anchor = intersectPt;
}

function IntersectionPt (ln1, ln2)
{
 var ua;
 var x1 = ln1[0][0], x2 = ln1[1][0], x3 = ln2[0][0], x4 = ln2[1][0];
 var y1 = ln1[0][1], y2 = ln1[1][1], y3 = ln2[0][1], y4 = ln2[1][1];
 ua = ((x4 - x3)*(y1 - y3) - (y4 - y3)*(x1 - x3))/((y4 - y3)*(x2 - x1) - (x4 - x3)*(y2 - y1));

 return [ x1 + ua*(x2-x1), y1 + ua*(y2-y1) ];
}

Tags: InDesign

Similar Questions

  • Can W7 \64 bit\FF42.0\How I move the profiles?

    Everything seems to work perfectly. But I realized that I should be able to find how to move my profile to another drive on my computer somewhere in the profile itself. I've looked everywhere I can think of and can't find this info. If you can tell me where it is, maybe I can manage. But if not, can you tell me how to move the profiles? My os is Windows 7 Pro 64 bit. I am running Firefox 42.0. Your guesses are all correct, except that I'm not sure about the plugin from Adobe. Thanks for any help.

    You can use the Profile Manager to create a new profile on a different hard drive folder by clicking on the button "choose a folder.
    Be sure to select a new empty file and not a folder that already contains files.

    You can transfer files from the current profile folder to this folder.

  • How to move the search return bar to the previous version?

    Using the latest update of Firefox gave me a new search bar, one where I can't change quickly, search engines to the contrary having to go into a menu to do so. This is detrimental for me since I use each search engine search suggestions, I installed. I can't do that. How to move the search return bar to the previous version?

    I found a solution. If you go in Subject: config, then find the browser.search.showOneOffButtons boolean and rocking that it restores the old functionality. (You may have to restart your browser)

    Note that, as always, to edit your subject: config at your own risk.

    credit: askvg.com

  • In FF 29,0, how to move the address bar on the top of the tab bar?

    It's OK in Firefox 28 and less than the value of browser.tabs.onTop = false to move the address bar on the top of the tab bar. But at 29 of Firefox, I can't find the browser.tabs.onTop
    who can tell me how to move the address bar to the top of the tab bar?

    Read this article. This article will help you to customize Firefox commands, buttons, and toolbars.

  • I want to know how to move the cards while trying to play stings on pogo

    Original title:

    Pogo games

    Hello, it was a gift of birthday a week ago.   So, I'm new on a laptop that I think I'm from fresh all over again.   But here's my question: I want to know how to move the cards trying to play spades on pogo.  Don't know how to slide or push enter or even pushing the button on the finger.  Please help I really like playing Spades and pinochle.  Thank you

    You should ask in the forum games Pogo, not Microsoft.

    http://Games-Forum.Pogo.com/

  • HOW TO MOVE THE FLAG POINT MAP, MIRCOSOFT 2013

    HOW TO MOVE THE FLAG POINT MAP, MIRCOSOFT 2013

    Hello

    It is not a Community Forum for MapPoint.

    Ask here

    Highway, Streets & Trips, MapPoint Forum:
    http://social.Microsoft.com/forums/en-us/streetsandtrips/threads

    Other Support options (not free)

    Support for MapPoint, streets & trips and Highway:
    http://support.Microsoft.com/ph/851

    Don

  • HOW TO MOVE THE FLAGS IN MICROSOFT MAP POINT 2013

    HOW TO MOVE THE FLAGS IN MICROSOFT MAP POINT 2013

    I suggest that ask you in this Microsoft forum:

    Highway, streets and Trips, MapPoint .

    Thank you.

  • How to move the MSWMM files and keep the data on my computer?

    I downloaded digital film from my camera to a destination on my D drive as a file MSWMM (collections), and whenever I try to move the downloaded film (collection), it does not recognize the movie more.

    How to move the MSWMM files and keep the data on my computer?

    The mswmm file is the project file, not a video.
    Think of it as a recipe for a cake, it only tells you what to do with the ingredients, but does not include the ingredients.
    The mswmm file tells the computer to look in a certain folder to use a video or audio file.
    If you move the file, then MM knows not where is the file, then you must tell it, by right clicking on a red x on the timeline and then choose search for the file.

  • How to move the original system to the SSD newly installed without an optical drive?

    I want to buy a W530 and spare SSD upgrade.

    I want to order one without a DVD player.

    How to move the system of origin, drivers and other software for the SSD newly installed without an optical drive?

    Hope someone could help me. Thank you.

    The two utilities that I mentioned manage alignment automatically. Also, I photographed my hard drive, then restored the SSD. I have no clone, which means a direct copy of the HDD to the SSD.

    I just went through this myself in July, using Acronis True Image 2012 to get my existing on my 256 GB SSD mSATA HARD disk image. It worked like a charm. I checked that the SSD has been properly aligned.

    See:

    Migrate to SSD

    and:

    Check the alignment of SSD

    Now stop worrying!

  • How to move the FILE from one place to another and keep "Indexing" have to move to the unknown location so you can't discover its full file path? Windows instructions provide information wrong re: how to do this!

    Make a bunch of audio files, placed in a folder on my desktop. Files initially sent to RealPlayer to burn, but when finished burning CD and went to read a CD, folder got seized by Media Player, 'Indexed' and disappeared from the office. I'm a relatively new computer user, and I need to learn more about file paths, how to view the path FULL of a file on my computer and how to type (create) full path when I need to. The "Indexing" feature seems to erase this lesson for me, and after having spent four hours trying to find Vista instructions on "How to move the file from one place to another", I gave up! Windows 'Help and Support' on my computer gives wrong directions. It states that if I right click on a folder > properties, a dialog box opens with a tab by which I can move my account. There is no tab location here. I found locations tab when right click on the "Mobile" folder, but still no option to "move file". No idea what is the folder "Roaming" or why it's on my computer. I want my audio files in the My Music folder, but this place is "access denied." Don't know how to get the audio file it in any case, but if anyone has any advice, I would be very happy! Thank you. PS - I had no problem moving folders in XP. I don't like the idea that a computer is to decide where to put my files. I want to control where I put my files. I don't like the way search works under Vista. I liked the XP search companion better because, for a computer fool like me, it was really easy to organize and find files and folders and had an option specific to find audio and video file TYPES.

    Here is an article on how to move your personal folders in Vista: http://www.howtogeek.com/howto/windows-vista/moving-your-personal-data-folders-in-windows-vista-the-easy-way/.  If you're talking about the special folders (such as photos, Documents, office...), then here is an article on how to move: http://www.winhelponline.com/articles/95/1/How-to-move-the-special-folders-in-Windows-Vista.html.

    If you have trouble with the search after you move the files, then rebuild the index: http://www.tech-recipes.com/rx/2103/vista_rebuilding_the_search_index/.  Here is an article on how to use Indexing Options in Vista that may be useful for you: http://www.vistax64.com/tutorials/69581-indexing-options.html.

    If the above does not help, your problem seems to relate to the image of the files/folders and their interactions with Media Center (which operate on different other folders).  Please repost your question in images and video Forum at: http://social.answers.microsoft.com/Forums/en-US/vistapictures/threads where the people who specialize in issues of the image will be more than happy to help you with your quesitons.

    Good luck!

    Lorien - MCSA/MCSE/network + / has + - if this post solves your problem, please click the 'Mark as answer' or 'Useful' button at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • How to move the top of the screen (active form)

    Hi all

    How to move the top of the screen (active form),

    Suppose I have 5 screens in the battery, I want to make the screen at the bottom of the stack as Active (top screen) without pushing and poping

    Of the display is a battery.  To move round on screens requires push and pop, as it would to move items in a stack.  Sorry, if you want to see the screen that currently is the bottom of the stack, then you either have everything that is above him, the pop or pop and push up.

    But here, we are talking about instances of the screen, not the specific screen class.  To understand the difference here is an example.

    I have two screens in my application, a list screen and a detail screen.  My application starts with the list screen.  The user selects an item (X) and displays details on the subject using the details screen.  While displaying the detail, the user decides that he wants to see a different list.  So, we start a new instance of the list screen, showing a different list.  Then, the user decides to view some details of one of the items on the list (Y) and if the application displays a new instance of the details screen.

    So now that the user has 4 screens on the display stack.  The top of the screen is a detail showing the item detail screen, the screen below is an example of the display of the list, the screen under that is another detail screen, showing the point X this time, and under that is a list screen.

    Does that help?

  • How to move the location of the key issues in Win 7

    In vista, I could go to the folder default Favorites (and links, downloads etc.) and under properties, change their location.  This meant that I was able to have all my favorites on my E: drive and not lost somewhere inside c: This makes backups easier etc.

    So to rephrase the question how to win 7 and IE 8 use Favorites in e:\favorites rather than c:\users\xyz\favorites\

    How can I do the same in Win 7?

    Read what follows:
    http://www.Winhelponline.com/articles/95/1/how-to-move-the-special-folders-in-Windows-Vista.html

    And also read this before do you:
    http://www.Winhelponline.com/blog/do-not-move-special-folders-to-the-root-drive/
    Andre Da Costa http://adacosta.spaces.live.com http://www.activewin.com

  • How to move the insertion point from editText ScriptUI?

    Hello.

    How to move the insertion point from editText ScriptUI?

    Please tell me the JS code.

    Thank you.

    I don't think you can. You can control the selection of text in an editText widget, but not the position of the insertion point.

  • How to move the virtual machine from one cluster to another cluster

    How to move the virtual machine from one cluster to another cluster

    If two Clusters are in the same data center, you could do a 'live' migration or vMotion, if that's the case.   If the virtual machine is turned off, it may be migrated regardless of the data center.

  • How to move the mouse position of puppetry, followed by position in photoshop?

    How to move the mouse position of puppetry, followed by position in photoshop?

    In Photoshop, handles (guides) are creating/editing mode shape with the pen tool. Select the layer with mousetrack in his name, and then in the pen tool, you should see a small "x" indicating the location of the handful of mousetrack. Press and hold the appropriate keyboard qualifier (for example, Ctrl on Windows) to select the 'x' and then drag it to the intended location.

  • How to move the code from right to left display panel

    How to move the code from right to left display panel

    You don't mention what version you have.  Go to view > uncheck the box design on the left.

    Nancy O.

Maybe you are looking for

  • SP4600 back to original BIOS

    Some time ago I have updated BIOS in my SP4600 to version 2.60. Unfortunately, this time I've done a copy of the original version of the BIOS that my computer came with. Now, I suspect that the change in BIOS of causes a malfunction in my computer an

  • For windows 98 Resource Manager

    Hello I'm working on the restoration of material capacity old test using some spare disks.  I'm looking in the resource Configuration Manager, and I am puzzled. I'm looking in the resource manager is National Instruments MAX (Version 2.0.3.17).  What

  • color of the icon class LVOOP

    I'm confused and I think I must miss a (simple?) detail somewhere. I'm updating the icons of all the members of a class of lvoop of a different color. Specifically, a shade of blue (RGB = 0 - 96-128). However, I get another shade of blue (RGB 0 - 102

  • Re-establish the connection to the router from Verizon Wireless

    I use IE6 on a portable Toshiiba with Windows XP. Our internet connection is via a Verizon Wireless router. Today, I can't run (Firefox or IE, by the way) - it does not detect the router. I am still able to connect to this router and internet through

  • EZXS55W bad ports?

    Im having trouble with two ports on my ezxs55w. Middle East - the two ports, 2, 3 do not work. Port number one and four seems to work well. When I plug a computer in #1 it works fine, then two or three, I get limited or is connectivity says im connec