Selection without limits of the selection

I use CS2 so I can't call on the limits of selection (which seems to be the preferred method of working with playlists)

var activeDocument.selection.bounds = SB;
var sbWidth = sb [2] - sb [0];
var sbHeight = sb [3] - sb [1];

Alert (sbWidth + "," + sbHeight)

If the code above does not work for me

How will I know (1) If a selection is set (selection width & height = 0?) and (2) find the width and height of the selection said, assuming that only the rectangle is used (no ellipse or lasso).

See you soon

Here are a couple of x functions that work with CS2...

function hasSelection (doc) {
if(doc == undefined) doc = activeDocument;
  var res = false;
  var as = doc.activeHistoryState;
  doc.selection.deselect();
  if (as != doc.activeHistoryState) {
    res = true;
    doc.activeHistoryState = as;
  }
  return res;
};
getSelectionBounds = function(doc) {
    if(doc == undefined) doc = activeDocument;
    var l = doc.artLayers.add();
    doc.selection.fill(app.foregroundColor);
    var bnds = l.bounds;
    var hs = doc.historyStates;
    if (hs[hs.length-2].name == "Layer Order") {
      doc.activeHistoryState = hs[hs.length-4];
    } else {
      doc.activeHistoryState = hs[hs.length-3];
    }
    for (var i = 0; i < bnds.length; i++) {
      bnds[i] = bnds[i].value;
    }
    return bnds;
}

Tags: Photoshop

Similar Questions

  • How crop to the artboard in CS5 without limits of the work?

    I am trying to save for the Web of a drawing in the CS 5, but he keeps the "adapt to the option limits work. Result is a jpg file with the size of the original drawing even after disconnection from the smallest area of the detailed work plan I want to use on the web.

    In CS2, I have just cropped out. How it work in CS5?

    In the save for web in the image tab there is an option to clip to the artboard check that and then hit underneath the button apply.

    You can also draw a work plan to the breast in a work plan to the size of the area that you want the art to be by pressing the SHIFT key while you start to drag the artboard tool hen release the SHIFT key when you drag to create a plan of work without the limited proportions.

  • (AS) Select the text of the paragraph without bringing out the carriage return

    (AS) Select the text of the paragraph without bringing out the carriage return character.

    I need help to select a paragraph in a story.
    The selection does not contain a 'return' (ASCII number 13 ")

    My current sample is as follows:
    -example assumes that the insertion point is already placed in a specific paragraph.

    Tell application "Adobe InDesign CS3"
    activate
    theDoc Set to the active document
    say theDoc
    Select the paragraph 1 of the selection
    end tell--theDoc
    end tell--app

    Sounds simple... The example above to select my paragraph selected.

    but he also chose the carriage return also. How would I go to do this?

    Any advice would be helpful!

    Thank you!

    Try:

    Select text in character-2 of paragraph 1 of the selection of character 1

  • How can I remove photos in an album that has been shared with me on my iPhone and Mac without unsubscribing to the album?

    How can I delete pictures on my iPhone 6 s and Mac Pro from an album shared with me without unsubscring to the album?

    Whence the Album? This would help to diagnose. Normally, on film, you select the photos you want, remove them and the album goes.

    If the Album has been synchronized from your computer using iTunes, then make a new synchronization without the selected album.

  • How to buy only a few songs, without registering for the new service? It seems compulsory now, and I DON'T want TO.

    How to buy only a few songs, without registering for the new service? It seems compulsory now, and I DON'T want TO. Could someone tell me just for the selection of the menu where I can search for a song by keyword and buy it?

    If it's on your iPad, then go to the app Store in iTunes, you can buy music from there

    If you do not want to use Apple music then turn it off on your iPad via the settings > music > Music Show Apple 'off '.

  • How can I configure my Internet XP connection so that it will automatically connect to my WiFi (wireless) without asking me the password whenever I connect?

    How can I configure my Internet XP connection so that it will automatically connect to my WiFi (wireless) without asking me the password whenever I connect?

    original title: automatic Wifi connection

    Hello

    By default, Windows XP attempts to connect to networks without wires in the following order:

    1. Available networks that are in the list of network preferred (by order of registration)
    2. Preferred networks in the list proposed (by order of registration)
    3. Other networks according to selected advanced settings

    Check out these articles and check if that helps:

    http://www.Microsoft.com/resources/documentation/Windows/XP/all/proddocs/en-us/wireless_networking_overview.mspx?mfr=true

    To connect to an available wireless network

    http://www.Microsoft.com/resources/documentation/Windows/XP/all/proddocs/en-us/wlan_client_connect.mspx?mfr=true

    To set up automatic wireless network configuration

    http://www.Microsoft.com/resources/documentation/Windows/XP/all/proddocs/en-us/wlan_client_configure.mspx?mfr=true

     

    5 steps: how to set up your network wireless home

    http://www.Microsoft.com/athome/organization/wirelesssetup.aspx

  • can I move all functions to another monitor and still close the laptop without turning off the second monitor on a laptop

    can I move all functions to another monitor and still close the laptop without turning off the second monitor on a laptop

    You define 'Action close lid' to the 'status quo' instead of sleep or Shut down:
    Go to-> double click "Power Options" Control Panel-> 'Select a power plan' under your selected plan, click "Change plan settings"-> "Change plan", click on the blue link 'Change advanced power'-> in 'Advanced settings' tab expand "power buttons and lid"-> extend the action of the 'close' lid, set "on battery" and "Plugged in" to "Do nothing"-> click apply-> OK button

    Multiple monitors: frequently asked questions
    http://Windows.Microsoft.com/en-us/Windows-Vista/multiple-monitors-frequently-asked-questions

    Set up multiple monitors
    http://Windows.Microsoft.com/en-us/Windows-Vista/set-up-multiple-monitors

    Move windows between multiple monitors
    http://Windows.Microsoft.com/en-us/Windows-Vista/move-Windows-between-multiple-monitors

    Understanding multiple monitors
    http://Windows.Microsoft.com/en-us/Windows-Vista/understanding-multiple-monitors

  • Windows Photo Gallery. How can I change the settings in the Windows Photo Gallery to automatically open the image without going to the index first?

    Windows Photo Gallery.  How can I change the settings in the Windows Photo Gallery to automatically open the image without going to the index first?

    Additional information: there are 2 computers that I use on the first Gallery Photo of Windows will open the image and allow me to use the left and right buttons to scroll through the rest of the photos in the folder, that's what I want.

    On the 2nd computer when I open an image it will open the Windows Photo Gallery in an index with thumbnails of the displayed record.  How can I change so that it opens the same thing as the first computer?

    I did the following on both computers; Right-click on the image and select open with...--> choose the default program--> go--> Program Files, Windows Photo Gallery, but it will be open always differently on computer 2.

    Both computers use Windows Vista 32-bit.

    Thanks in advance.

    Australian salvation,

    This would happen if the file associations are corrupted on the computer, try method to set Photo Gallery Windows as the default program for opening files jpeg or png below image types.

    (a) open default programs by clicking the Start button, click default programs.

    (b) click on associate a type of file or Protocol with a program

    (c) in the following list of file protocol search jpeg and make sure that you have associated with the program that uses it and then check if it works.

    Change the programs that Windows uses by default

    http://Windows.Microsoft.com/en-us/Windows-Vista/change-which-programs-Windows-uses-by-default

    I hope this helps!

    Halima S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • I can install Windows 7 without initially providing the product key?

    Peut I install Windows 7 without initially provide the product key during installation?  I'd rather go once the installation is finished, I just have to copy and paste it in the email like that.

    Hello

    Yes, you can try a free key of Windows 7 Installation. But be sure that you enter the product key to activate Windows wihtin 30 days grace period. Once the 30 days grace period end your system will go in any safe and you may need to reinstall the copy again.

    Unlike Windows Vista, if you si vous achetez buy Windows 7 DVD you get specified edition disk and installation you will not get an option to select the edition. Almost to the last step of the Installation, you will get the opportunity to enter the product key that you can jump and try to enter the product at the time of the Activation key.

    http://social.technet.Microsoft.com/forums/en-CA/w7itproinstall/thread/7d72d093-Eee7-40F4-9550-cbda71b2fcdd

    Thank you
    Hamidou ndiaye

  • Disable on screen keyboard without turning off the touchscreen (regarding the use of Microsoft Word)

    I don't want to turn off the on-screen keyboard.  Whenever I'm in mircosoft word, typing a document, it is upwards.  I use my fingers to scroll and down to my Word document while I work on that.  But if I touch the screen wrong then the on-screen keyboard appears.  It is very stirring.  I want to disable the onscreen keyboard without turning off the touch screen.  How can I do this?

    My question has nothing to do with the signature in my computer.  It has everything to do with me working on documents in Microsoft Word.

    I don't want to turn off the on-screen keyboard.  Whenever I'm in mircosoft word, typing a document, it is upwards.  I use my fingers to scroll and down to my Word document while I work on that.  But if I touch the screen wrong then the on-screen keyboard appears.  It is very stirring.  I want to disable the onscreen keyboard without turning off the touch screen.  How can I do this?

    My question has nothing to do with the signature in my computer.  It has everything to do with me working on documents in Microsoft Word.

    Hello

    You can disable the on-screen keyboard of touch using the following steps.

    • Press the Windows key + W to display the Search bar.
    • Services of type and press enter.
    • Scroll to the bottom for the Touch screen keyboard and writing panel service.
    • Right-click on this service and select Properties. Click the drop-down menu in the Startup type section, and then select Manual. In the Service status section, click the stop button.
    • Click Apply/OK.

    Concerning

  • Why im getting this error: "ORA-22813: value of the operand exceeds the limits of the system.

    HI EXPERTS...

    Please helpme to fix this...

    I have a database of oracle 11g, runnint on a Windows Server 2008:

    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production

    I have two tables:

    CREATE TABLE UTILS. SEG_ROLES

    (

    VARCHAR2 (12-BYTE) APPLICATION,

    ROL VARCHAR2 (12-BYTE),

    USERS VARCHAR2 (255 BYTE)

    )

    TOGETHER TO DEFINE

    Insert into SEG_ROLES (APPLICATION, ROL, USERS) Values ('MULTIPLAN', 'ADMIN', 'ADMIN');

    Insert into SEG_ROLES (APPLICATION, ROL, USERS) Values ("MULTICLIP", 'CAR01', 'PATY');

    Insert into SEG_ROLES (APPLICATION, ROL, USERS) Values ("MULTICLIP", "CAR02", "FABIOLA, ERIKA");

    Insert into SEG_ROLES (APPLICATION, ROL, USERS) Values ("MULTICLIP", "CON01', 'LUCY, PATY');

    Insert into SEG_ROLES (APPLICATION, ROL, USERS) Values ("MULTICLIP", 'CON02', 'VALERIA');

    COMMIT;

    CREATE TABLE UTILS. SEG_ACCESOS

    (

    VARCHAR2 (12-BYTE) APPLICATION,

    ADMROL VARCHAR2 (12-BYTE),

    VARCHAR2 (20 BYTE) MENU,

    OPCION VARCHAR2 (20 BYTE),

    TYPE VARCHAR2 (5 BYTE),

    OBJETO_MENU VARCHAR2 (40 BYTE),

    ACCESO VARCHAR2 (2 BYTE),

    ROLES_ACCESOS VARCHAR2 (255 BYTE)

    )

    TOGETHER TO DEFINE

    Insert into SEG_ACCESOS (APPLICATION, ADMROL, MENU, OPTION, TIPO, OBJETO_MENU, ACCESO, ROLES_ACCESOS)

    Values ("MULTICLIP", "ADMIN", "ROOMMA", NULL, am', 'm_coloca', the of ', 'CAR01, CAR02');

    Insert into SEG_ACCESOS (APPLICATION, ADMROL, MENU, OPTION, TIPO, OBJETO_MENU, ACCESO, ROLES_ACCESOS)

    Values ("MULTICLIP", "ADMIN", "PUT", "PREVALIDA", "SM", "sm_prevalida", the from ', 'CAR01, CAR02');

    Insert into SEG_ACCESOS (APPLICATION, ADMROL, MENU, OPTION, TIPO, OBJETO_MENU, ACCESO, ROLES_ACCESOS)

    Values ("MULTICLIP", "ADMIN", "PUT", "PRECOLOCA", "SM", "sm_preColocacion", the from ', 'CAR01, CAR02');

    Insert into SEG_ACCESOS (APPLICATION, ADMROL, MENU, OPTION, TIPO, OBJETO_MENU, ACCESO, ROLES_ACCESOS)

    Values ("MULTICLIP", 'ADMIN', 'LOVE', "COLOCACIÓN", "SM", "sm_colocacion", the from ', "CAR01");

    Insert into SEG_ACCESOS (APPLICATION, ADMROL, MENU, OPTION, TIPO, OBJETO_MENU, ACCESO, ROLES_ACCESOS)

    Values ("MULTICLIP", "ADMIN", "PUT", "REGCOLOCA", "SM", "sm_regcoloca", the from ', "CAR01");

    Insert into SEG_ACCESOS (APPLICATION, ADMROL, MENU, OPTION, TIPO, OBJETO_MENU, ACCESO, ROLES_ACCESOS)

    Values ("MULTICLIP", "ADMIN", "LDP", NULL, am', 'm_PLD', the of ', "CAR01, CAR02, CON01 CON02");

    Insert into SEG_ACCESOS (APPLICATION, ADMROL, MENU, OPTION, TIPO, OBJETO_MENU, ACCESO, ROLES_ACCESOS)

    Values ("MULTICLIP", "ADMIN", "LDP", "LN_CONSULTA", "SM", "sm_PLD_LNConsulta", the from ', 'CAR01, CAR02');

    Insert into SEG_ACCESOS (APPLICATION, ADMROL, MENU, OPTION, TIPO, OBJETO_MENU, ACCESO, ROLES_ACCESOS)

    Values ("MULTICLIP", "ADMIN", "LDP", "LN_BARRIDOMASIVO", "SM", "sm_PLD_LNBarridoMasivo", the from ', "CAR01");

    Insert into SEG_ACCESOS (APPLICATION, ADMROL, MENU, OPTION, TIPO, OBJETO_MENU, ACCESO, ROLES_ACCESOS)

    Values ("MULTICLIP", "ADMIN", "LDP", "REP_INICICLO", "SM", "sm_PLD_ReporIniciclo", the from ', 'CON01, CON02');

    Insert into SEG_ACCESOS (APPLICATION, ADMROL, MENU, OPTION, TIPO, OBJETO_MENU, ACCESO, ROLES_ACCESOS)

    Values ("MULTICLIP", "ADMIN", "LDP", "LN_BITACORA", "SM", "sm_PLD_LNBitacora", the from ', "CON01");

    COMMIT;

    - And this point of view:


    CREATE VIEW UTILS. VW_ROL_USER AS

    Select distinct APPLICATION, ROL, trim (column_value) USUARIO

    from (SELECT APPLICATION, ROL, USERS USER

    FROM UTILS. SEG_ROLES

    WHERE IT IS NOT NULL TO USERS

    ORDER BY APPLICATION, ROL

    ) t,.

    XMLTable ((' «' ||)) Replace (USER, ",", "",""). '"'))

    order by APPLICATION, ROL, trim (column_value)

    CREATE VIEW UTILS. VW_ACC_ROL AS

    Select distinct APPLICATION, ADMROL, MENU, OPTION, TIPO, OBJETO_MENU, ACCESO, trim (column_value) ROL

    (SELECT APPLICATION, ADMROL, MENU, OPTION, TIPO, OBJETO_MENU, ACCESO, ROLES_ACCESOS ROL

    FROM UTILS. SEG_ACCESOS

    WHERE ROLES_ACCESOS IS NOT NULL

    ORDER BY APPLICATION, ADMROL, MENU, OPTION

    ) t,.

    XMLTable ((' «' ||)) Replace (ROL, ",", "",""). '"'))

    MENU, TYPE, OPTION, APPLICATION control, trim (column_value)

    CREATE VIEW UTILS. VW_SEG_ACCESOS AS

    SELECT VACR. APPLICATION, VACR. MENU, VACR. TIPO, VACR. OPCION, VACR. OBJETO_MENU, VACR. ACCESO, VACR. ROL, VUSR. USUARIO

    FROM UTILS. VW_ACC_ROL VACR,

    UTILS. VW_ROL_USER VUSR

    WHERE VACR. ROL = VUSR. ROL

    ORDER OF VACR. APPLICATION, VACR. ROL, VACR. MENU, VUSR. USUARIO, VACR. TIPO, VACR. OPCION

    When I ask the last posting, it works fine:

    SELECT VSEG.* IN UTILS. VW_SEG_ACCESOS VSEG

    But when I add conditions:

    SELECT VSEG.* IN UTILS. VW_SEG_ACCESOS VSEG

    WHERE VSEG. APPLICATION = "MULTIPLAN.

    AND VSEG. USER = 'PATY '.

    It generates this error:

    ORA-22813: value of the operand is greater than the limits of the system

    Cause: The value of the object or the Collection was too big. The size of the value might have exceeded 30 k in a context of TYPE, or size may be too large for the available memory.

    Action: Choose a different value, and try the operation again.

    Why?

    Thanks in advance...

    Finally found a SOLUTION at: http://stackoverflow.com/questions/14328621/oracle-10g-splitting-string-into-multiple-rows

    just change the way we create the view using the regexp_substr.

    CREATE VIEW UTILS. VW_ROL_USER AS

    SELECT distinct trim APPLICATION, ROL, (regexp_substr (USERS, ' [^,] +', 1, level)) USER

    FROM UTILS. SEG_ROLES t

    WHERE IT IS NOT NULL TO USERS

    CONNECTION BY instr (USERS, ',', 1, level - 1) > 0

    order by APPLICATION, ROL

    Thank you all

  • I use Lr5 on a PC, working on the Nikon RAW files. Without even touching the images, they lose their shine after a few seconds. Why and how can I keep the liveliness to the origin?

    I use Lr5 on a PC, working on the Nikon RAW files. Without even touching the images, they lose their shine after a few seconds. Why and how can I keep the liveliness to the origin?

    Step 1: Adjust an image in Lightroom, until you are satisfied with its appearance

    Step 2: Use develop-> new preset, select all selections in the new preset dialog box (note: I always uncheck the exhibition here, who should probably be adjusted picture, I'm mostly interested by contrast, vibrance and camera calibration settings)

    Step 3: In the import dialog box, on the right, under appliquer apply when importing, select the preset desired beside development parameters

  • Limitation of the recipient

    Hello
    I use 11g with GNU / linux.
    When I schedule a report, I chose 20 recipients of users. (20 critics have the e-mail account).
    And I added manually the Mail 4 id

    the recipient of the message so total = 24

    Could you please let me know what is the limitation of the user recipient selection and manual mail ID users.

    Thank you
    Gram

    Hello

    It is about 5,000 users by default. (it is based on the Configuration of the LDAP server, you can also increase the size limit of the AD or set up several groups)

    Thank you
    Deva

  • Update without waiting in the update and delete command.

    Dear all,

    My database is GR 11, 2 on Linux.

    What is the best way to resolve the line lock if 2 different sessions commands delete records from the same table?

    Can we use to update without waiting in the Update or Delete command?

    Thank you
    Imran

    What you can do too, is that you can perform the update that you did for the update with select... see the following topics

    declare
    cursor c1 is
    Select * from EMP
    where deptno = 20
    Update;
    Start
    for c1_rec looping c1
    Update emp
    Set sal = 11
    the location being c1;
    end loop;
    end;
    /

    Concerning
    Karan

  • 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) ];
    }
    

Maybe you are looking for