Change the width of the rectangle, based on the page number in InDesign via Javascript

I have a rectangle called "pageBar" on my master page!

I would like to create a script that automatically resizes the width of the rectangle based on the number of page.

Something like: "width = 1280 * (PageNumber / pageTotal)" "

Any help would be appreciated.

Thanks in advance,

J.

Hi Trevor,

I did it like this...

var myDocument = app.activeDocument,
myPages = myDocument.pages,
totalPages = myPages.length,
currentPage = 1;

function getPercent(a) {
    b = (a / totalPages);
    return b;
}

for (var i=0,l=myPages.length; i

Thanks for your comments.

Tags: InDesign

Similar Questions

  • Batch to change the page size of InDesign documents

    I have about 300 documents in InDesign (2014 cc, Mavericks) a page of various page sizes. Each page is wider than 4 inches and 4 inches larger than the content of the page. The content is in middle of the page - actually make a margin of 2 inches (but with no margin guides) around the content. What I need to do, is get the page of all documents will have to be a specific page size, 7,125 "x 9.75".

    I was able to accomplish this by putting all the docs in a book, make a master page 7,125 "x 9.75" on a doc, synchronize the other docs and then opening each doc and apply the master page. The last piece was a bit a lot of work and I would like to avoid it in the future.

    Could write a script that opens some InDesign documents (in or not in a book) and changes the various sizes of page to the necessary size? I've never written scripts before, so no idea if it's possible or how to do it.

    I put the following on another forum and got help, but it took that I have control over the creation of the original documentation. And I did not. "Is there a way to globally apply a master page to all pages of all documents in a book?

    Any help is greatly appreciated.

    Hello

    What is your requirement

    var myFolder = Folder.selectDialog("Select the Folder contains Indesign Files")
    
    var myFiles = myFolder.getFiles("*.indd")
    
    alert("Total Indesign Files: " + myFiles.length)
    
    for(i=0; i
    

    Concerning

    Siraj

  • change the page number

    Hello
    is it possible to change the pagenumber assigned to pages.

    By example, if I create the pages 1, 2, 3 and 4 and later delete page 2. How can I rename the page '3' page name '2 '.

    This is necessary because I'm using the url that points to page 2 in many external applications and want to avoid the manual changes.

    in the interests of, for example, let's say that
    https://Apex.oraclecorp.com/pls/Apex/f?p=11232:2 is my link that takes me to my original page 2 and then I created the page 3 more.
    After the removal of the 2 page, now I want to page 3 to appear on the same URL, and this can happen if I can I reallocate page 3, Page 2.

    Thank you for your help in advance.
    SS

    Hello

    You can also create a Page 2 a copy of Page 3 and then delete Page 3.

    Regadrs,
    Martin

  • How to change the page number

    question.PNG

    by using this object.

    Thank you.

    I got the answer.

    app.activeDocument.documentPreferences.startPageNumber = 15;

    Thank you interesting.

  • Change the page size - grayed out of boxes

    I'm changing the page size of the pages within a document. Apparently, you're supposed to select the pages in the Pages panel and then change the height and width of the Panel settings. My height and width boxes are grayed out. What have I done wrong?

    Your screenshot shows you the active Selection (the black arrow) tool, not the Page tool (the third tool from above).

  • Change the page size and text in Firefox 35.0.1

    I had a small red P at the top right of Firefox that changed the page size and the fonts that I lost after a reset: How do I get it back?

    Do you mean this extension?

    You can check the "Old data Firefox" folder on the desktop to see what extensions you previously had.

  • ICloud Keychain how can I change the phone number needed to verify the code text for me? The number it was sent is an old phone number of my friends that I do not have access to the.

    ICloud Keychain how can I change the phone number needed to verify the code text for me? The number it was sent is an old phone number of my friends that I do not have access to the.

    Try this from another thread I saw.

    On iOS, go to settings > iCloud > keychain and tap button to disable iCloud keychain. (you will be asked to delete or keep the passwords on device) I chose to delete...

    Then turn it back on, and pop - up chose reset iCloud trousseau, on a chosen pop-up confirmation reset

    In the new window pop up use iPhone password like iCloud cryptogram? has chosen the use code

    Enter your secret code (4 digits) then choose country and your new phone number

    Although, to "Restore the iCloud Keychain," I took to erase the data and essentially set up a new keychain.  Not the case.  Strangely, after essentially bypassing the security system, setting a new password and verification number, I see my cards, passwords and other data have been restored.  Maybe it's all the iCloud account and this master password.  Or maybe it's a bug.  With Apple, we'll never know.

    Also have a look here: get help using iCloud Keychain - Apple Support

  • How can I change the phone number to use Face Time?

    How can I change the phone number to use Face Time?

    Your phone number come from your SIM, and when you open a session and activate FaceTime. It should appear automatically. If it is not, then I would say that your FaceTime does not complete the activation process. If you go to settings > FaceTime, you see something awaiting activation or waiting for activation under the switch to turn it on?

  • How to change the serial number when the system board is replaced

    How can I change the serial number of the system in the bios of a D530 SSF when replacing the motherboard?

    Hello:

    I suppose that if that's all you can do with this utility, then it of all you can do.

    I do not think I said that the utility likely to modify or add the model number, nor asked the question originally.

    You will need to contact HP technical support and have a technician HP bios with any other information you need to tattoo.

    Paul

  • change the phone number in apple ID

    change the phone number in apple ID

    Yes

  • How can I change the phone number in apple ID

    How can I change the phone number in appleid

    Hi alistair290,

    Welcome to the communities of Apple Support! If you want to check or change the linked phone number to your Apple ID for use in iMessage and FaceTime, you can find information and the steps in the following article useful:

    Link your number of iPhone and Apple ID to use iMessage and FaceTime - Apple Support

    See you soon

  • HP folio 13-2000: changing the serial number on a HP Folio 13-2000 after changing of Council of administration of the system

    Hello

    I replaced the motherboard on an HP Folio 13-2000 and im having trouble changing the serial number to match the previous motherboard

    I tried the back HPSET152.exe tool and the tool wndmifit in windows that said "this motherboard is not supported.

    Does anyone have any suggestions?

    Thank you

    Matt Davey

    HP CDS engineer

    Hello

    These tools are available only for authorized service partners and must not be shared.

    If you are an employee of HP, please HP service team for more details.

  • Change the Port number of e-mail outgoing "587" as required to use the Comcast e-mail

    When my email out through Comcast did not all Comcast more, technical support told me that I had to change the number of Port for outgoing in Windows Live Mail beta 110 to 587.

    Worked well, until I had a system crash.

    When I reinstalled Windows Live Mail, I could fine is no longer the 'Tools' button in the status bar and by result cannot change the port number.  So, I can't send emails from Comcast of Windows Live Mail.

    The inbound port setting is apparently correct already, as I had no reception bad don't mail... sending mail.

    I hope it will work for you.  I use Windows Live Mail 2009.

    If you look on the left side of the window, you will see the name of your e-mail account.  (Underneath there is Inbox, drafts, sent items, etc.)
    You'll want to right-click on the name of the mail account. (Right above where it says Inbox.)
    Then you'll want to click on properties.
    A properties box opens.  You'll want to click on the tab "Advanced" on the right side of the Properties window.
    The first area is the SMTP (outgoing) port number.  You just want to change it in 587.

  • How to change the phone number of Simulator

    Hi Experts,

    Please help me on how to change the phone number of blackberry Simulator.

    Thanking you in advance,

    In JDE:

    Edit-> preferences-> Simulator-> network-> phone number

  • Prevent the user from changing the page in URL - Apex 5

    Dear community of Apex,

    We seek to protect our handling of URL pages.  The protection of session state is enabled, and each page has page value «Arguments must have Checksum» access protection  However, the documentation seems to discuss in order to prevent the user from element values in the URL.  We want to prevent the user to change the page ID in the URL.  Currently, a user is able to hack the URL and take in the middle of a wizard process for example.  Is it possible to stop this?  Other that an element of creative previous train stop check.

    * Version: Application Express 5.0.1.00.06

    Thank you

    Barry

    bSamuel wrote:

    We seek to protect our handling of URL pages.  The protection of session state is enabled, and each page has page value «Arguments must have Checksum» access protection  However, the documentation seems to discuss in order to prevent the user from element values in the URL.  We want to prevent the user to change the page ID in the URL.  Currently, a user is able to hack the URL and take in the middle of a wizard process for example.  Is it possible to stop this?  Other that an element of creative previous train stop check.

    Hi Barry

    Affecting the security attribute Access Page Protection page No. URL Access and navigate between pages using the type of the Page Management Branch (uncheck the option creates a branch using redirection page in the Wizard) will avoid this:

    No URL access -Page can not be found using a URL, but the page can be the target of a type of Page Management Branch, is not doing a URL redirect.

    It is a little more restrictive that a normal direction of the session state values cannot be positioned or erased declaratively in the branch, but is not often necessary in a several step wizard, and it's pretty simple to work round using prior processes - or post-branche or by referencing the item values directly from other pages.

Maybe you are looking for