Using JavaScript to insert Pages

First of all, thanks to you all for helping me try to get out.

Please be patient with me as I am new to the script and a complete Newbie which includes only the basics.

OK, so I'm working on a side project to where I work. The goal is to develop a script that will allow users to run and automatically add 4 pages at a time. These pages will be in spread (facing pages).

We (society) print books of a sort, and due to printing in printers spreads, this is how all our models are configured. Is not necessarily how it should be done, or how I would setup models, but that is how it is and I have to work with what I have.

For this reason, I can't use the building in functionality that is already in InDesign for Smart Text Reflow, but that's essentially what I have set out to achieve.

I was looking around the Internet for some time and found a few different scripts that are already out there that work to a certain degree, but not exactly how I need to make them work.

Below, I'll show what I want to achieve:

Here's an example of how we have our model in place.

Screen shot 2014-05-13 at 15.02.27.pngScreen shot 2014-05-13 at 15.02.35.png

All scripts, I found and tried to adapt to what I seem to do the following:

Screen shot 2014-05-13 at 15.02.55.png

All they'll do is add a page at a time and in the wrong place (this should be on the left, NOT the right).

Screen shot 2014-05-13 at 15.03.20.pngScreen shot 2014-05-13 at 15.03.24.png

When adding the second page (via the interface of the menu or change any script I think) the second page is added as follows:

Screen shot 2014-05-13 at 15.03.36.pngScreen shot 2014-05-13 at 15.03.39.png

Now, I already know that it is because of how we have our configuration of models, but I can't change that!

However, if the following functions is used via the menu of the interface, then the results work perfectly:

Screen shot 2014-05-13 at 15.03.52.png

Screen shot 2014-05-13 at 15.04.09.png

Screen shot 2014-05-13 at 15.04.28.pngScreen shot 2014-05-13 at 15.04.18.png

It is this feature that I would like to reproduce but shaped script:

Layout > insert > Pages...

4 pages

At the end of the Document.

If someone could help to shed light on this, it would be extremely beneficial.

Scripts I did experiment with current examples are:

myDocument = app.activeDocument
myDocument.spreads.item(1).allowPageShuffle = true;
var page=myDocument.spreads.item(1).pages.item(1);
var pages= myDocument.pages.add(LocationOptions.atEnd);
var pages= myDocument.pages.add(LocationOptions.atEnd);
myDocument.spreads.item(1).allowPageShuffle = false;

Once again, thank you in advance.

Sam

Typical, shortly after this announcement I really understand it.

For those interested, this seems to work correctly:

myDocument = app.activeDocument

var page=myDocument.spreads.item(0).pages.item(0);
var pages= myDocument.spreads.add(LocationOptions.atEnd);

Sam

Tags: InDesign

Similar Questions

  • Insert pages with Javascript

    Hello

    Is it possible to insert pages using Javascript? I would like to insert a page from a file on the click of a button. I used the following as a "Mouse Up" event on a button:

    this.insertPages ({nPage:this.numPages - 1, cPath:"InsertExampleSource.pdf"});})

    but it doesn't seem to work...

    Any help would be appricated.

    It may be, but not only with them. You will need to use a script of confidence in a file that is installed on the local computer to make it work.

  • I want to export a report to several pages to CSV using javascript code... Please suggest

    I want to export a report to several pages to CSV using javascript code... Please suggest

    Hi SubhajitChakraborty,

    If you are using Internet explorer as web browser, then confirm your request in Internet Explorer development Forums.

    http://social.msdn.Microsoft.com/forums/en-us/iewebdevelopment/threads

    If you use a Web browser to explore, then look for JavaScript communities to help.

  • Component to using JavaScript in Page template

    How to find a UIComponent to supporting using JavaScript?

    var Ow = AdfPage.PAGE.findComponentByAbsoluteId ('pt_aot1'); null

    I could, for those who have the same problem, been passing the id of the template that is located in the main container.

    < --="" templatedefault.jsf="" --="">

    -> Release to ID

    ...

    <-- index.jsf="" --="">

    http://Java.Sun.com/JSF/core"xmlns:af ="http://xmlns.oracle.com/adf/faces/rich">."

    -> Model ID container

    <-- javascript="" --="">

    var Ow = AdfPage.PAGE.findComponentByAbsoluteId ('pt1:pt_aot2'); ---> tempID + OutputID

    Thx for help

  • Use of javascript within the page fragment

    Im trying to use javascript code within a fragment of a page with the tag

    AF:resource

    But the second time the page reloads I got this error: "ReferenceError: works is undefined"

    <af:resource type="javascript">
          function funciona() {
              alert(123);
          }
    </af:resource>
    

    IM using JDeveloper 12 c

    Check the 'witch hunt during the use of JavaScript in the regions of the ADF' in this document http://www.oracle.com/technetwork/developer-tools/adf/learnmore/march2012-otn-harvest-1571998.pdf

    Timo

  • You want a javascript redirect URL using a previously defined page element?

    Hello
    I have a button where I set up a redirect to the URL option and you use: javascript:html_PopUp('http://yahoo.com',_'_newwindow').

    It's pretty clear, and it works. I also have a defined page element that contains a valid URL
    For example: P4_OFFICE_WEB_PAGE_LINK_V: = 'http://google.com '.

    I want the pop up to use a stored value, not the hardcoded hard a top... I tried all these, but none seem to work:

    JavaScript:html_PopUp('P4_OFFICE_WEB_PAGE_LINK_V',_'_newwindow');
    JavaScript:html_PopUp(':P4_OFFICE_WEB_PAGE_LINK_V',_'_newwindow');
    JavaScript:html_PopUp(APEX_UTIL.) GET_SESSION_STATE ('P4_OFFICE_WEB_PAGE_LINK_V'), '_newwindow');

    What should I use?

    Thank you.

    Hello

    Try

    javascript:html_PopUp('&P4_OFFICE_WEB_PAGE_LINK_V.', '_newwindow');
    

    Kind regards
    Jari
    -----
    My Blog: http://dbswh.webhop.net/htmldb/f?p=BLOG:HOME:0
    Twitter: http://www.twitter.com/jariolai

  • Convert pages of propagation for unique pages using javascript

    Hi all

    Is there a way to convert all pages in the spread or pages face to face unique pages in an Indesign document using javascript. I use Indesign CS6. Used master pages are unique pages only. Thanks in advance.

    Before:

    Spreadpages.PNG

    After:

    Singlepages.PNG

    Kind regards

    Bachi. D

    Hello

    app.activeDocument.documentPreferences.facingPages = false;

    app.activeDocument.spreads.everyItem () .allowPageShuffle = true;

    Rgds

    Jarek

  • Add javascript to the page template to use in all the pages resource...

    ADF:11.1.2.1.0
    WebLogic: 10.3.5

    In the code source temlate I want to add:

    "" < af:resource type = 'javascript' source = '... / resources/scp.js "/ >

    SCP.js is the javascript library that have functions that we like to use on many web pages like letters, validations, etc etc.

    <? XML version = "1.0" encoding = "UTF - 8"? >
    < jsp:root xmlns:jsp = "http://java.sun.com/JSP/Page" version = "2.1".
    xmlns:f = "http://java.sun.com/jsf/core".
    xmlns:af = "http://xmlns.oracle.com/adf/faces/rich".
    xmlns:trh = "http://myfaces.apache.org/trinidad/html".
    xmlns:tr = "http://myfaces.apache.org/trinidad" >

    < jsp:directive.page contentType = text/html"; Charset = UTF - 8 "/ >
    "" < af:resource type = 'javascript' source = '... / resources/scp.js "/ >
    < var af:pageTemplateDef = "uploading" >
    ........
    < / af:pageTemplateDef >
    < / jsp:root >

    This is possible, or is not appropriate to add af:resource on model?

    Yes, this should work and should NOT have problems.
    We have a similar approach in our current project and it works as expected.

    Thank you
    Nini

  • How to use javascript to go to different pages?

    I use javascript to pop-up a message box with selection or not.

    If the user select Yes, and then I want to go to page 10.
    If the user select No, and then I want to go to page 12.

    How to use Javascript to control which pages to go?

    Thank you.

    Now, I need to get the values of entries in the list.

    What are the values that you need to get your entries in the list?

    Can you post JS and what you're trying to do?

    Kind regards
    Hari

  • Go to the previous page by using javascript

    Hello

    I want a dynamic button BACK (using JAVASCRIPT) feature, which will lead me to the previous page, which I had.

    Thanks in advance.

    Hello

    If you just want to emulate the back button of the browser clean, you can use:

    <a href="javascript:window.history.go(-1)">Back</a>
    

    Andy

  • How can I download and run updates of Java, when my browser simply refuses to go the recommended Web sites or any other Web page using JavaScript?

    I can't go to the Java website to download the updates in the Firefox browser and it will not go to other sites that use JavaScript. I tried disabling my firewall, but this makes no difference.

    I noticed with some sites I can enter them, but I cannot view items that have been created with JavaScript, for example. my own Web site at http://shaedandu.com.au... Some objects such as my Thawte security seals do not appear, and even other people tell me that they appear on the live version that they see in their browser.

    I cleaned my internet cache several times in the last week... Return to Windows Internet Explorer help either, even though I prefer Firefox my default browser.

    Can offer you a solution?

    Adrian McG
    [Melbourne - Australia]

    Ok... Looks like I'm tackling the problem from the wrong end!

    I'll check my internet connections.

    Thank you Tyler.

    Adrian McG

  • How to use Javascript to loop through a tabular presentation

    APEX: 4.2.3

    DB: 11 GR 2

    Requirement:

    I have a master form / retail. We will see that master is the order information; Detail is the order lines. Detailed form is tabular

    The detailed form, there is an attribute called 'Line Order Qty' and the user can update this field.

    User can update all rows in the detail forms and change "line Order Qty' for each line. When the user click on 'Save' button on Master form, I have to do below:

    Sum of the 'line Order Qty' for all lines, and compare it to another field called 'Plan Order Qty' on the master shape.

    If sum 'Line Order Qty' > "Plan Order Qty", then it should appear a message with "Are you sure?" with two buttons on the message: OK and cancel.

    If users click on 'OK', the application will proceed and update another field called 'Sum of Order Qty' on the main form and the value set for the sum of "Online Order Qty" for all lines;

    If the user clikc 'Cancel', the application will be paused. The user must come back to change "Line Order Qty", and then try again

    given, I need a popup message when the validation, I think I have to write javascript; However, in the javascript code, I need complete all lines in detail (tabular form) to get the

    The sum of the 'line Order Qty'. Then I can compare the value and to launch the pop message if validation has failed?

    By reading this thread: building the perfect beast: Oracle APEX - Soft Validation using dynamic measurements

    I think I need to create a reference for action (DA) dymaic Javascript expression; However, in Javascript, how do I browse a table?

    Yet once, I need an example of using Javascript to browse tabular forms in the form master / detail.

    I don't know that my question should be raised before; but I can't find a good match of thread.

    Thank you!

    Kevin

    Hi Kevin Zhang,

    Sum of the 'line Order Qty' for all lines, and compare it to another field called 'Plan Order Qty' on the master shape.

    If sum 'Line Order Qty' > "Plan Order Qty", then it should appear a message with "Are you sure?" with two buttons on the message: OK and cancel.

    If users click on 'OK', the application will proceed and update another field called 'Sum of Order Qty' on the main form and the value set for the sum of "Online Order Qty" for all lines;

    If the user clikc 'Cancel', the application will be paused. The user must come back to change "Line Order Qty", and then try again

    given, I need a popup message when the validation, I think I have to write javascript; However, in the javascript code, I need complete all lines in detail (tabular form) to get the

    The sum of the 'line Order Qty'. Then I can compare the value and to launch the pop message if validation has failed?

    Follow the steps below

    Step 1: Change your page - > function and declaration of the Global Variable-> to insert the code below

    (i) f06 is here, the column on which I am looping the f06 column and enters the total variable to the value change in the values of the row that is changed by the user.

    (II) also replace your column with f06 markup on which you want to loop and calculate the total

    (III) assuming that P6_ITEM is the point where you plan_order_qty, replace with your article.

    (IV) SAVE this demand is what happens when OK is clicked, assign the request to process.which you give the floor to a click of the button SAVE the

    function update_order_qty () {
      var line_order_qty_tot = 0;
      $("input[name='f06']").each(function() {
        line_order_qty_tot += parseFloat($(this).val().replace(/,/g,''))||0;
      });
    
      var plan_order_qty = apex.item( "P6_ITEM" ).getValue()
    
      if (line_order_qty_tot > plan_order_qty) {
          apex.confirm('Are you sure?', 'SAVE');
      } else {
          apex.submit( 'SAVE' );
      }
    }
    

    Step 2: Edit the page-> Execute when loading the page-> to insert the code below

    \\calculate the total on change
       $("input[name='f06']").change(function(){update_order_qt();})
    

    Step 3: Change your button Save and put under the Action when the button is clicked

    Action: Redirect URL

    Target URL:

    javascript:update_order_qty();
    

    Hope this helps you,

    Kind regards

    Jitendra

  • Pop - up using javascript in dynamics of the Actions

    Hi all

    Before you begin with the question, I want to share the below of the details on the application

    Table creation script

    create table status_dashboard (ID number, name varchar2 (10), varchar2 (10) State, varchar2 (1000)) URL;

    Insert the script

    insert into status_dashboard values 1, 'A1', 'up', 'www.ibm.com';

    insert into status_dashboard values 1, 'B1', 'up', 'www.hp.com';

    "insert into status_dashboard values 1, 'C1', 'up', ' www.msn.com";

    insert into status_dashboard values (1, "D1", "low", "www.yahoo.com'");

    insert into status_dashboard values 1, 'E1', 'up', 'www.oracle.com';

    insert into status_dashboard values 1, 'F1', 'up', 'www.facebook.com';

    insert into status_dashboard values (1, 'G1', 'down', 'www.twitter.com');

    "insert into status_dashboard values 1, 'H1', 'up', ' www.google.com ';

    insert into status_dashboard values 1, 'I1', 'up', 'www.apex.oracle.com';

    Report query

    SELECT max (case when mod (rn, 3) = 1 then end name) col1

    , max (case when mod (rn, 3) = 2 then end name) col2

    , max (case when mod (rn, 3) = 0 then end name) col3

    , max (case when mod (rn, 3) = 1 then decode (status, 'down', 'red', 'green') end) The_color1

    , max (case when mod (rn, 3) = 2 decode (status, 'down', 'red', 'green') then end) The_color2

    , max (case when mod (rn, 3) = 0 then decode (status, 'down', 'red', 'green') end) The_color3

    , ceil ((rn) / 3)

    (select name, status, row_number() on rn (order by name) of status_dashboard)

    Group by ceil ((rn) / 3)

    order by ceil ((rn) / 3)

    Report link on Oracle Apex

    https://Apex.Oracle.com/pls/Apex/f?p=54850:1

    I created a matrix report, enabled the conditional formatting. The only problem I have right now is to go to a link in the report.

    I use 3 text elements Apex - P1_ID, P1_NAME and P1_URL.

    I use also 3 dynamic actions

    1. DEFINE NAME - will set the P1_NAME field with the value clicked in the report.

    2 SET ID & URL - define the fields P1_ID and P1_URL of the DB using the P1_NAME field.

    3-pop-up-appears the P1_URL using javascript.

    Problem statement:

    The pop up page is a blank page, although I can see that the value for the P1_URL field is defined using dynamic measurements.

    Could someone please take a look at this example and help me with the same.

    PS: The example was developed using sample data.

    Hello

    When you use the substitution in JavaScript string, the value is used when page and is pretty hard-coded in the document value.

    Even if you change the value of the element or the element value in session state, it will not happen to the HTML document.

    In dynamic action, try something like

    popupURL($v("P1_URL"))
    

    Who will choose the value of the item and pass it to the popupURL function.

    Yes, you have created, sample, but how we can view source if we are unable to connect your workspace?

    Kind regards

    Jari

  • Discount contained IRR (State report but maintaining current IRR) using Javascript

    Apex: 4.2.2.00.11

    AJAX (dynamic measurements) are used to change the data (rows/columns of data) than the SORT of reports on an Apex report page. The last step in the dynamic action (that example closes the jquery ui widget used to add/insert/delete a line), I would like to refresh the IRR - without a reset of the IRR filters, like oders, etc..

    Currently using a call to gReport , but the reset() methods and pull() time resets the IRR, take off the filters and so on.

    Did some research on Google and have not seen this specific question answered, or covered in the manual of the Apex Javascript API.

    Question: is there a method simple IRR updating can be done without a reset and update only the current content of data displayed by the IRR - from Javascript?

    Billy,

    Have you tried:

    $('#YOUR_IRR_REGIOD_ID_HERE').trigger ('apexrefresh');

    -Joe

  • Insert page numbers

    I just started using Microsoft Works Word processor. Why a feature for a long time in Microsoft Word (insert page numbers) does not work?

    Microsoft Works supports page numbers: it is in the header or the footer.  You don't mention what version you have. Header, footer, Page #: Click viewon the Menu bar at the top of the screen. Click on headers and footers to. Type the text that you want in the header or the footer in the appropriate window. (You can add page numbers to your document by typing& p in the header or the footer windows. After the & p or other text that you type in these windows to left-, Center-, or justify right page number or text, type & l,& c, or & r . (You can also use& f for the file name of your printed document automatically in the header or the footer). Here is an article on how to start the page numbering on page 2 rather than on page 1 in severalhttp://support.microsoft.com/kb/76167versions, but the instructions you also lead to where you need to add page numbers.  Microsoft Word is a more sophisticated than Microsoft Works program and has many more features (and cost more).

    Assuming that you do not want to pay for Microsoft Word or any of the Office Suites, I recommend to download and install the FREE OpenOfficewww.openoffice.org , which includes many of the most popular Microsoft Office products (Finally, programs that do the same things, but not really Microsoft) which a writer who is a comprehensive word processing program and can do almost everything that Microsoft Word can do (and more Microsoft Works can do) - including the numbering of the pages.  This is a great set of programs and again, they are FREE, so you have nothing to lose by trying of their and see if it will do the work for you.  I am sure that you prefer them on Microsoft Works and some people even they prefer on Microsoft Office (even if I personally prefer Office - probaby because I'm used to it as much as anything else).

    I hope this helps.

    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.

Maybe you are looking for

  • iMac does not connect to wifi

    I have a 2011 27 iMac 3.1 ghz with i5. I'm under El Capitan 10.11.6 which is the most updated version. I never had a problem with before wireless. Recently, my iMac had to enter the bar of genius due to graphics card failure. Costing almost 400GBP to

  • How to make a word in a link to a website under Mac OS 10.11.6?

    I have a word or two in a link to a Web page the merchant products.  How do Mac OS 10.11.6?

  • Create new Apple ID with an email address incorrect

    I accidentally packed an Apple ID with an invalid email address. I don't remember either my password or security issues. Now I can't reset the password by e-mail. The iPhone is still under warranty. I'm desperate. Someone knows what to do?

  • Bluetooth does not work on my Satellite L750/114

    I have a latitude L750/114. Features say it has bluetooth 3.0 HS.I tried to activate it, but I can't. If I press Fn + F8 does not appear the Bluetooth option. In the installer there is no option to enable / disable this option.Thank you

  • Windows Update history

    I recently did a system restore and an update for Windows7 failed because it was already installed about to restore, I'm back too. How to delete history of update failed. It's really annoying to see a update failed in the history of my update when I