Script to move a selection from the limits of spread?

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

1-oversize-pasteboard.png

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

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

2-contents-pasted-too-low.png

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

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

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

3-first-try-to-move.png

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

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

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

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

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

indesign #target - 11.064 / / CC 2015

myDoc = app.activeDocument;

myPages = app.activeDocument.pages;

myActivePage = app.activeWindow.activePage;

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

App.Select (SelectAll.All);

App.Copy ();

// 2. Open the template file and paste

whichExportTemplate = "FCILG";

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

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

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

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

app.pasteInPlace ();

App.Select (SelectAll.All);

// 3. POSITION IT

var myPage = myActivePage;

var myMargins = myPage.marginPreferences;

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

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

// 4. Save the new file

// 5. Close

5-layers.png

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

Quick and dirty:

//TWO InDesign documents are open
//The SOURCE document is the ACTIVE one

var myTargetDoc = app.documents[1];

myTargetDoc.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;
myTargetDoc.zeroPoint = [0,0];

//Group everything on the active page of your SOURCE document:
var myActivePage = app.layoutWindows[0].activePage;
var myGroup = myActivePage.groups.add( myActivePage.pageItems.everyItem().getElements() );

//Target the second document for the duplicate of the group:
var myDuplicate = myGroup.duplicate(myTargetDoc.pages[0]);

//Move the duplicate:
myDuplicate.move([0,0]);

//Tidy up a bit:
myDuplicate.ungroup();
myGroup.ungroup();

Hope, that helps.

Uwe

Tags: InDesign

Similar Questions

  • I use a PC and I used LR3. I'm a newcomer to LR, so patient with me! My problem is related to the import function. I have a photo library on an external hard drive. I slowly imported previews of the photos selected from the library in

    I use a PC and I used LR3. I'm a newcomer to LR, so patient with me! My problem is related to the import function.

    I have a photo library on an external hard drive. I've slowly been import previews of the photos selected from the library in my catalog, adding them during the import process - well. But now, I hit a problem. Another folder in my library contains several subfolders, each containing a number of photos (a mixture of RAW steals (naves) and jpg). I was importing found in my catalog each Subfile in turn, using the Add function, usually of the jpgs only from each Subfile. It works fine, until I reached a particular Subfile. For some reason when I try to import from it and select the secondary file as a Source, only the RAW (NEF) images appear in the preview pane (sorry, forgot the correct term for it!). I know that jpg files are in this auxiliary file on the external hard drive, because when I view its content in Windows, they are all there. But try as I can (choose the file under source, select the folder parent as a source, try to copy or move them, instead of adding them), nothing seems to work. Since they do not appear in the preview pane, I can't import them. It does appear that this a Subfile where the problem exists, but I don't see anything that is different from the others (names of files under all use the same structure - yyyy-mm-dd_custom name, and pictures in all subfolders are adopting the same denomination structure too - yyyy-mm-dd_sequential number_custom name.) NAVE/JPG. So what I am doing wrong? Any ideas please.

    It is possible that the images in this particular subfolder were taken in your camera in RAW + JPEG.  If so, you will need to go to preferences under the general tab and make sure the box "processing JPEG files files next to raw as separate photos" is checked.

    However, assuming that this is the case, there is really no reason to import the JPEG file if you already have the RAW file.

  • I would like to have at least 1 of my toolbars that are displayed at the bottom of my browser open screen. How can I move a toolbar from the top to the bottom of the page?

    I would like to have at least one of my toolbars that are displayed at the BOTTOM of my browser open screen. How can I move a toolbar from the top to the bottom of the page? I don't want to do this by using an extension, and when I read about the extension, I really have not seen how it would move the toolbar to the top-down any browser page open.
    Thanks in advance for the supply, the answer and the procedure to get this accomplished.

    You can't drag an entire toolbar to the bottom of the window. The Bar of the Addon is a "toolbar", drag whatever you want from the Palette to customize or a toolbar up to the bar of the Addon.

  • LENOVO S 60 - how can I move messages deleted from the Inbox?

    How can I move messages deleted from the Inbox?

    Once you click on the e-mail.to, read it, it should have an option to move electronic mail.

    The menu button is the physical button next to the original key.

  • Image display according to the value selected from the bean of choice

    Hello

    I have a table with columns of bean of choice and have an another bean image

    based on the value selected from the bean of choice of a particular line, I want to display an image in the column of bean image

    and it is particularly in the line, in which the user changes the value of the bean of choice.

    Please help me

    Thank you

    Hello
    H1.

    If I choose 'user' of choice its not display any image, but I need disabled display images it

    -have you set the URI of the Image of the time of the image?
    -deleteicon_enabled.gif N deleteicon_disabled.gif

    Concerning
    Meher Irk

    Published by: Meher Irk on October 24, 2010 12:18 AM

  • ORA-22992: cannot use LOB Locators selected from the remote tables...

    Oracle 10.2.1.0.4
    Solaris 10

    We try to access a table in another database via a db_link.

    The table we are trying to access has a LOB.

    We get the following error: ora-22992: cannot use LOB Locators selected from the remote tables.

    Is there a way to get around this? We need the data in the BLOB field.

    Thank you.

    See on metalink:

    ORA-22992 has a workaround solution in 10 gr 2
    DOC - ID: 436707.1

    Werner

  • In first items 14 scene selection from the Menu movie (Motion, holiday, Christmas frame) does not bind the scene 6 main Menu page. It places the scene 6 2 Menu scenes, but unrelated to the other, the main or scene selection Menu. What it

    How can I edit a movie Menu template? I use a Motion - celebrations and events - model of menu for Christmas related to 6 scene markers. Five scenes are represented by a thumbnail and name on 1 Menu scenes that appears when the button on the main menu page scene selection is reached. However, the scene 6, which has also a sticker and marker corresponding scene, is on another page (Menu 2 scenes) that does not link to the home page (does not appear in the scene selection Menu that has just 5 thumbnails and an arrow to return to the main Menu). In the area of work under the clip monitor Main Menu 1, Menu 1 and Menu 2 of scene scene appear together and by clicking on the thumbnail in the scene 2 menu the link to the clip 6 works except when Preview Disc is played, in which case the Menu 2 scene disappears. The scene marker is correctly linked, it just does not appear in the menus of the finish. The first five items of the Assembly (related to the scene selection menu) are all the video clips, but the 6th clip is a slide show. I read several threads on menus but found no mention that a slide show scene marker is treated differently by a menu template. Is it? The 5 first clips are all in the format AVI - DV with imported project files previously saved in this format, so that they could be related and engraved on a DVD. The slideshow is imported from PSE14 and 6 attached clips have already been burned successfully on disk (without menu) as a try-out. However, I was not satisfied with the resolution, then saved individually at the only other resolution DVD - SD576. Now I'm stuck at getting this sort menu. I operate 10 WIN. Any help will be accepted with gratitude.

    Hi, thanks for your response. I can rephrase the question very easily: why I've been so stupid? My problem was that I couldn't see a link in the menu between the Menu scenes 2 template and the main Menu. It turns out that the link was there all the time (a sideway arrow just above the main Menu link) but I thought he was part of the link from the main Menu and never clicked on it. When I burned my project to a disc and played on television, the sideway arrow was a different color and, of course, another link... the link I was looking for. Then, my apologies, problem solved, lesson learned - click on everything you see. Thank you. And I was very happy since the upgrade to 14 before except when it makes me feel stupid, which is frequently.

  • How to move the selection from the magic wand of 2 pixels tool to take off the edges?

    Hello

    I am trying to make a selection with the magic wand tool and move the edges of the selection by a pixel or two, but the button "refine edge" does not seem to do anything.  I want to cut a pixel on the edge of an image that I cut into another image.  Any help would be great thanks.

    Depending on whether you have selected the image or the background, use Select > modify > expand your selection or select > modify > contract selection

  • Is there a script to move several tabs at the same time

    Is there a script or a way of being able to move several tabs at the same time - I need to change the size of a document and all the tabs need to move at the same time - is it possible to do so.  Have several financial sheets should reformat - thank you very much!

    Jjust found a cool script of Shane Stanley moving several tabs in indesign [Archives] - Desktop Publishing Forum that works just the way I want it – here it is:

    say application "Adobe InDesign CC 2014"

    the value theMeas to my doIDdialog()

    set theTabList to tab list of the paragraph 1 of the selection

    set theTabPositions to position of tab stops to paragraph 1 of selection as points

    Repeat with I from 1 to the number items in theTabList

    set the position of the point of theTabList to 'p' i & ((point I of theTabPositions) + theMeas)

    end Repeat

    define tab list some points of selection at theTabList

    end say

    on doIDdialog()

    say application "Adobe InDesign CC 2014"

    the value measUnits to measure horizontal units of view preferences of the document 1

    Try

    destroy each dialog box

    end try

    Set restart to make dialogue with properties {name: "Putting the selection handles"}

    the value C1 to do dialogue column restart

    do static text in C1 with properties {dynamic label: "' amount to move all tabs:" "}

    the value C2 do to column of the dialog box to restart

    the value mComb1 to do measure combobox to C2 with properties {min width: 80, content Edition: '1', big helping hand: 10, nudge: 1, string list: {'-25', '-20', '-15', '-10', '-5', '5', '10', '15', '20', '25'}, change the units: measUnits, value: 1000 maximum, minimum value:-1000}

    activate

    with timeout to 10000 seconds

    Show reboot

    If result = false then

    beep

    Restart to destroy

    Error number-128

    end if

    end timeout

    the value comboMeasNum1 to change value of mComb1

    Restart to destroy

    end say

    return comboMeasNum1

    end doIDdialog

  • Select from the drop-down list and populate a list in another menu drop down

    I have a drop down list with 10 items in the list. If possible, would like for a selection in the drop-down list to populate a drop-down list with another list of selections. Each of the 10 points in the first list each will have a list of different options in the second drop-down list. I don't know how to build this solution.

    Thank you

    MDawn

    Hello

    It was because of the clear rawValue script that I put in the output from the drop-down list event businessFunction.

    I fixed it:

    // clear the current selection in the department dropdown
    dept0.rawValue = null;
    dept0.execEvent("exit");
    

    https://Acrobat.com/#d=MrWYQbTZIR7xJQDlm5ZSLg

    Good luck

    Niall

  • Is it possible to move PDF files from the clouds of document to dropbox

    Is it possible to move or drag a PDF document cloud directly to dropbox?

    I don't want to download the PDF of DC files to my computer and then upload to dropbox.

    Hi jay,

    I'm sorry, it will not possible to move files PDF of the Document cloud to the drop box. However you can open the file saved on cloud of Document, select Save as in the file menu & click on tab of Dropbox to save the file to the Dropbox account.

    Kind regards
    Nicos

  • How to create a report based on the item selected from the list of selection?

    Hello

    I created a tables_LOV based on:

    Select table_name table_name user_tab_cols r, d

    where column_name like '% _type % '.

    Then I created a ListOfTables page element, display in a selection list and pointing to tables_LOV.

    I run the page, and I can choose the table I want in the drop-down list.

    How to create a report based on the selected element? (ex: select * from selected_table)

    Thanks in advance

    Salah

    Hi Salah,

    Allright, take a look at this page: http://apex.oracle.com/pls/apex/f?p=vincentdeelen:collection_report

    I think that simulates what you are trying to accomplish. I've implemented the simplest method I could think of.

    The report is based on a collection of apex. If you are not familiar with this, you should study the documentation: APEX_COLLECTION

    To recreate my example, you should:

    (1) create a report (interactive) on your collection

    SELECT *
       FROM APEX_collections
     WHERE collection_name = 'MY_COLLECTION'
    

    (2) create a selection list page_item for the tables that you want to display (in my case, this is called "P38_TABLES")

    (3) create a dynamic action that triggers on the evolution of your selection list page_item. Dynamic action must be a parade of PL/SQL procedure the following code:

    declare
      l_query varchar2(4000);
    begin
      l_query := 'select * from '||:P38_TABLES;
      if apex_collection.collection_exists
            ( p_collection_name => 'MY_COLLECTION' )
      then
        apex_collection.delete_collection
          ( p_collection_name => 'MY_COLLECTION' );
      end if;
    
      apex_collection.create_collection_from_query
        ( p_collection_name => 'MY_COLLECTION'
        , p_query           => l_query
        );
    end;
    

    Make sure that you add your page_item 'Page to send items' section.

    (4) add a real extra action that makes an update of the report area.

    Here are two photos describing the da:

    http://www.vincentdeelen.com/images/OTN/OTN_COLLECTION_REPORT_DA1.PNG

    http://www.vincentdeelen.com/images/OTN/OTN_COLLECTION_REPORT_DA2.PNG

    Good luck and greetings,

    Vincent

    http://vincentdeelen.blogspot.com

  • produce a series of numbers to select from the shortcomings of the ID column

    (1)

    Suppose I have a table t that contains lines like this:

    A AND B
    ---------- ----------
    2 4
    6 7

    I would like to use select to produce lines with numbers between a column and column B included
    for each line, like this:

    Select from t...

    2
    3
    4
    6
    7

    (2)

    Suppose I have the ID column that is lacking, I want to get the lowest < N > numbers available between the gaps.
    I did some research and I can find the range of gaps, but I can't get the numbers listed separately, therefore
    I ask the question (1). But is there a direct way for the list instead of going through beaches and the list.

    For example, I have the ID column that has

    2
    5
    6
    7
    9
    2000000

    I would get a select query that produces

    Select...

    3
    4
    8
    10
    11

    I have a way to get a list of 2 to 2000000, then less than what we need to get all the
    numbers of the gap, but who is not effective and may is short-term memory.

    PS: before I post on this group, I did some research already on "connect by", with recursive queries.

    PuraVidaOTN wrote:

    I would like to use select to produce lines with numbers between a column and column B included

    for each line, like this:

    Assuming that no duplicates in the table...

    with t as
    (
     select 2 c1,4 c2 from dual union all
     select 6 c1,7 c2 from dual
    )
    select c1,c2,c1+level-1 c
    from t
    connect by c1+level-1 <= c2
    and prior c1 = c1
    and prior c2 = c2
    and prior sys_guid() is not null;
    
    C1 C2 C
    -- -- -
     2  4 2
     2  4 3
     2  4 4
     6  7 6
     6  7 7 
    

    Suppose I have the ID column that is lacking, I want to get the lowest numbers between the gaps.
    I did some research and I can find the range of gaps, but I can't get the numbers listed separately, therefore
    I ask the question (1). But is there a direct way for the list instead of going through beaches and the list.

    I have a way to get a list of 2 to 2000000, then less than what we need to get all the
    numbers of the gap, but who is not effective and may is short-term memory.

    It's the best way in my opinion...

    Or rather less, you can try outer join...

    Published by: JAC on December 19, 2012 21:28

  • Create the table in select * from the other table

    DB: 11.2.0.2

    How to create a table with structure only not empty the data that we do not generally create table in select * from... But the command will pull the data also. How to create without data?

    create table foo
    in select * bar
    where 1 = 0

  • Notify the application that the Quit is selected from the dock icon menu

    I'm building Air application icon menu dock, is there a way for me to know if the 'Quit' from the context menu on the Dock icon is selected? I looked at the "closing" is not what I'm looking for as this is also sent when the user clicks the X button on the application.

    Thank you.

    The trick was to manage 'EXIT' event

    http://StackOverflow.com/questions/1338152/detecting-different-quit-options-in-air-applica tion on mac

Maybe you are looking for