Odd and even rotating pages by file name

Hi all,
Hoping someone can help me trouble shoot my script below.
The aim is to determined if the last two digits of the file name are odd or even and then rotate the file accordingly.
I have been able to get the page rotation work by it's self but it seems to do nothing at all when trying to get the last two digits of the filename and use them as the variable "pgNum".
Files will be named using the following convention....
aa-02-02.pdf
Thank you in advance for you help.
=======================================================================================
var re = /.*\/|\.pdf$/ig;
var filename = this.path.replace(re,"");;
var pgNum = filename.substring(-2);
try {
    if(pgNum % 2) {
        var crtpagerotate = this.getPageRotation({nPage:i});
        this.setPageRotations({nStart: i, nEnd: i, nRotate:(270+crtpagerotate)%360});
    else {
        var crtpagerotate = this.getPageRotation({nPage:i});
        this.setPageRotations({nStart: i, nEnd: i, nRotate:(90+crtpagerotate)%360});
catch (e)
    console.println("Batch Aborted: " + e )

Try this:
var re = /\.pdf$/i;
var filename = this.documentFilename.replace(re, "");
var pgNum = +filename.slice(-2);

Similar Messages

  • Odd and Even Headers in Pages 5

    I think this has been asked before, but is it possible to making different odd and even-paged headers in Pages 5? I can't figure it out.

    You can take this to be the answer for most things Pages 5…
    … No!
    Use Pages '09 instead.
    Peter

  • Different margin for odd and even pages

    Hi there,
    I am writing a book which will be printed in 2 sided paper. Therefor I will need different margin (left and right) for the odd and even pages.
    How is it possible in Pages? I am using Pages 5.2 (1860).
    Thank you.
    Sebastian.

    Indesign & Xpress are professional DTP applications. They can layout pages in any order you can imagine with custom margins. They are also complex to learn & expensive in comparison to Pages.
    There is a trial of Indesign IIRC…
    https://www.adobe.com/uk/products/indesign.html
    Quark also has a trial too…
    http://www.quark.com
    I expect there may be cheaper 'layout' software that is capable of arranging facing pages correctly (possibly from a single pages PDF export from Pages), but I just avoid apps like Pages if I need a finer level of output control.

  • Printing odd and even pages separately (manual duplex)

    Hi
    I searched the forum and found some similar problems regarding Adobe Reader 8.1.2 : Adobe Reader 8.1.2 doesn't print odd and even pages correctly
    This was posted more than a year ago. A few days ago I encountered the same problem with Adobe Acrobat 8.1.2. I suspected that it could be beacause of outdated software. I then applied incremental patches up to 8.1.5. But the problem still persists.

    The link was about Reader, but I tried it with AA8.1.5 on a 3 page document and did indeed find the same problem. The 1st page printed out, but the 3rd page was missing when printing the odd pages. When printing the even pages, the 2nd page printed out 2 times. The 3rd page never showed up. I think this is what you are talking about. Wonder if they fixed it in AA9?

  • Is it possible to have different margin settings for odd and even pages?

    Hi guys.
    I am formatting a book I want to get printed and it would be very helpful to have different margin settings on the odd and even pages so the text won't fall too close to the gutter (as happened in the proof copy I ordered!).
    It's possible to do this on Word, but I can't seem to do it on Pages? Am I missing something?
    Any help would be greatly appreciated. Thank you

    Thanks Peter. I upgraded to Pages 5 a while back. I guess my next question is.....is there any way I can downgrade to Pages 09...anywhere I can still download it from?
    Seems a bit of a backward step, but needs must

  • How do I create an Lightroom HTML Gallery and preserve the - in the file name?

    How do I create an Lightroom HTML Gallery and preserve the - in the file name?
    The hyphen (-) is more search engine friendly, so I label all my photos using hyphens (-) to separate the keywords in the file name
    Here's a sample file name - it's for the "Guess Where Berkeley" flickr site
    guess-where-berkeley-serkes-xx-s-curve.jpg
    I created a Lightroom HTML Gallery and posted it to the following link.
    http://www.berkeleyhomes.com/tests/lightroom/lightroom-test-1/
    Though it looksl like the HML gallery shows the original file name in the web page, it looks like Adobe Lightroom modified each photo's file name by changing the - (hyphen) to an underscore (_)
    Originally
    guess-where-berkeley-serkes-xx-s-curve.jpg
    After Adobe created the HTML photo gallery the name became
    guess_where_berkeley_serkes_xx_s_curve.jpg
    Is there any way to preserve the – rather than the _ character
    Thank you!
    Ira Serkes

    InDesign's interactive PDF support is a small subset of what you can do in Acrobat Profesional.
    I think you probably want to create a button (or change an existing button) in Acrobat Pro that causes Acrobat to close the document -- that should be analagous to "exitting the CD." I assume your autorun file is opening the PDF in Adobe Reader? You have not included it and are not specific, so it is tough to say.
    I believe in Acrobat Javascript you can close the document with this.closeDoc(). You'll probaly need to ask on the Acrobat forums (possiby Acrobat Scripting) for more detail.

  • How to specify Master page depending on odd or even first page

    We've set up our books to delete empty pages and so that we have chapters starting on both odd and even pages. Also, the first pages of our chapters are formatted differently than the rest of the Left and Right Master pages. We would like to have two Master pages for the first page of the chapter, one for odd pages and the other for even, so that we can offset the margins, leaving a larger margin on the side towards the binding.
    My question is how do I set up the book so that when it generates, if the chapter starts on an odd page, it automatically applies the Master page for odd first pages and when the first page is even, it applies the Master page for even first pages?
    We have FramMaker 8 and are running it on Windows XP Professional.
    Thanks,
    Tim

    Assuming that you want this to happen automagically, I'd use the system default Right and Left Master pages as your chapter opener pages because Frame will apply those automatically depending on how the pages and chapters fall in the book. Then set up the internal chapter pages with whatever other structure you're using and apply those internal masters to the normal content that as you go.
    If you can't do that for some reason, I would look at doing it with a FrameScript that goes through the book and applies the alternating pages as a final production step.
    You could set up the first tag in the chapter to call a specific master page, but that would be manual and could quickly go south if any chapters ahead of a given chapter change the pagination. It would have to be manual because a given tag can only call one master page -- there isn't a way to apply logic to call one or the other depending on the situation.

  • Three finger or two finger gesture to move back and forward between pages of file only work on safari, unlike with old os. this new lion won't let me do it. Any help?

    three finger or two finger gesture to move back and forward between pages of file only work on safari, unlike with old os. this new lion won't let me do it. Any help?

    I have decided to dedicate this thread to the wonderful errors of Lion OSX. Each time I find a huge problem with Lion I will make note of it here.
    Today I discovered a new treasure of doggie poop in Lion. No Save As......
    I repeat. No Save As. In text editor I couldn't save the file with a new extension. I finally accomplished this oh so majorly difficult task (because we all know how difficult it should be to save a file with a new extension) by pressing duplicate and then saving a copy of the file with a new extension. Yet then I had to delete the first copy and send it to trash. And of course then I have to secure empty trash because if I have to do this the rest of my mac's life I will be taking up a quarter of percentage of space with duplicate files. So this is the real reason they got rid of Save As: so that it would garble up some extra GB on the ole hard disk.
    So about 20 minutes of my time were wasted while doing my homework and studying for an exam because I had to look up "how to save a file with a new extension in  mac Lion" and then wasted time sitting here and ranting on this forum until someone over at Apple wakes up from their OSX-coma.
    are you freaking kidding me Apple? I mean REALLY?!!!! who the heck designed this?!!! I want to know. I want his or her name and I want to sit down with them and have a long chat. and then I'd probably splash cold water on their face to wake them up.
    I am starting to believe that Apple is Satan.

  • I can not transfer date from one hard drive to another, I keep getting an error because I have two of the same file names and one file name is in caps and I cant change the file name

    can not transfer date from one hard drive to another, I keep getting an error because I have two of the same file names and one file name is in caps and I cant change the file name. My original external has an error and needs to be reformatted but I dont want to lose this informations its my entire Itunes library.

    Sounds like the source drive is formatted as case sensitive and the destination drive is not. The preferred format for OS X is case insensitive unless there is a compelling reason to go case sensitive.
    Why can't you change the filename? Is it because the source drive is having problems?  If so is this happening with only one or two or a few files? If so the best thing would be to copy those over individually and then rename them on the destination drive.
    If it is more then you can do manually and you can't change the name on the source you will have to reformat the destination as case sensitive.
    Btw this group is for discussion of the Support Communities itself, you;d do better posting to Lion group. I'll see if a host will move it.

  • WCF Service and Sharepoint Form library : How i can read a access a form libray and query a item from file name and read form xml in WCF service ?

    WCF Service and Sharepoint Form library : How i can read or access a form libray and query a item from file name and read form xml in WCF service ?
    Ahsan Ranjha

    Hi,
    In SharePoint 2013, we can take use of REST API or Client Object Model to access the SharePoint objects like Form Library.
    SharePoint 2013 REST API
    http://msdn.microsoft.com/en-us/library/office/dn450841(v=office.15).aspx
    http://blogs.technet.com/b/fromthefield/archive/2013/09/05/working-with-sharepoint-list-data-odata-rest-and-javascript.aspx
    SharePoint 2013 Client Object Model
    http://msdn.microsoft.com/en-us/library/office/fp179912(v=office.15).aspx
    http://msdn.microsoft.com/en-us/library/office/jj193041(v=office.15).aspx
    With the retrieved file, we can then use XmlDocument object to parse it and get the values you want:
    http://weblogs.asp.net/jimjackson/opening-and-reading-an-xml-file-in-a-document-library
    http://stackoverflow.com/questions/1968809/programatically-edit-infopath-form-fields
    Best regards
    Patrick Liang
    TechNet Community Support

  • Music I already have on my computer will not pull up in itunes. I dragged the files, copied the files,  and even tried adding the files but nothing works. The songs play on any other program except for itunes. What do I do??

    Music I already have on my computer will not pull up in itunes. I dragged the files, copied the files,  and even tried adding the files but nothing works. The songs play on any other program except for itunes. What do I do??

    OMG......THANK YOU THANK YOU......I been reading articles after articles and nothing was working......tryed the Crtl+S and there it was. I can not thank you enough......I appricate it    Can not believe it was that simple. I am one happy person again.....

  • Odd and even pages

    Hello all, Need some help on the xdp that I am working on.
    This xdp has 1 Page Set- set to Print on Both Sides.
    The first master page is the Odd Pages (Front pages).
    The second master page is the Even Pages (Back pages).
    There isn't much logic on the Even Pages as it is only static information.
    The content on the Odd (Front) pages flow and page number grow depending on the XML data I feed into it. I have explicitly set the content to flow through the content are of the Odd (Front) page only. Problem is, when the data breaks, it still puts a record or two on the content area of the Even (Back) page.
    Also, I was hoping that whenever there is an Odd (Front) page, I would assume that it would always have an Even (Back) page, but that is not the case. Sometimes the pages end out on the Odd Page.
    I would like to share the xdp along with the xml that I am working on to this posting. Is there a way to upload this information. Thanks in advance.

    Hi,
    The trouble is that when you have repeating objects they will continue in the container as new instances are added. When the page overflows, Acrobat/Reader is creating a new instance of the page, in which the new instances of the repeating object can be rendered.
    I had an example earlier that "jumped" a section, but in reality what it was doing was when the first page was full, it started to use a similar repeating instance on page3. Here it is, but you will need to have a close look at the script, as this was not annotated: https://acrobat.com/#d=0-YvJ8UcVW7Pyc4hhg3RmQ. It is a bit of a rough workaround, based on the height of the subform (see the click event of the add button on page1).
    You might also be able to get a conditional page break to work if the height of the rows was always the same.
    Hope that helps,
    Niall

  • Why is LR importing duplicate files and adding a -1 to file name?

    I need to locate some missing photos that disappeared from my library so I'm re-importing my photo collection again (from burnt DVD's) in hopes to recover all the missing images. When I insert a DVD to re-import the photo collection and choose "convert to DNG" and I check "do not import suspected duplicates" LR imports the same images that are already in the catalog and renames the images with a -1...for example, IMG_3664.dng is already in LR folder named 2008-06-14. When I re-import the images from that date, LR renames the image IMG_3664-1.dng and puts it in the same folder resulting in duplicate images side by side. Why is it importing the same image and adding a -1 to the file name?
    I was expecting it to tell me there are XXX photos already in the catalog but it doesn't. It just adds a -1 to the file name and imports all the duplicate images and displays them side by side in the grid view.
    Any ideas? I originally imported the images from the same DVD's I'm using now on a PC and placed the library on an external hard drive. NOw I'm using a new iMAC and I imported that same library from the same external drive location. I'm working with LR 1.31.
    Can someone help? LR should recognize the files with the identical date/time stamp and tell me it's already in the catalog...but it's not for some reason.
    Thanks

    If you import them again, you'll get a "-2" instead of -1, and the -2 will list with the -1,and the original with no dash. The higher number distinguishes the most recent file of same title..
    The file titles are identical as original, but it sounds as converting the file from the source,(PC, Hard drive) to DNG makes it another version of the file....do you type DNG in caps? should it be lower case?
    Because the computer doesn't read the file as a duplicate, but the file name is the same, you'll get a -1.
    This could probably happen,say, if your files are raw, and you had burned them as jpeg onto dvd storage. Even though you want them back as raw, converting them isn't duplicating them.
    I hope this helps...I don't even own Lightroom; I'm shopping around between this and Aperture right now...the experience I'm referring to is where I work in a pre-press printing house; So if someone replying to my post who masters in Lightroom calls me an idiot, I won't argue much!!

  • How to track pages printed, file names

    Can my printer track pages printed and file names?
    HP Deskjet Ink Advantage 5525 e-All-in-One Printer
    Thank you
    EvEd

    Sorry that can not be done.  You will have to keep track manually.
    Say thanks by clicking the Kudos Thumbs Up to the right in the post.
    If my post resolved your problem, please mark it as an Accepted Solution ...
    I worked for HP but now I'm retired!

  • On windows 8 and itunes 11 i try to sync my iphone and it says a duplicate file name was specified and won't let me sync, what do i do ?

    duplicate file name was specified...... windows 8 and itunes 11...... won't let me sync..... what do i do ?

    OK, read this thread... https://discussions.apple.com/thread/3928453
    tt2

Maybe you are looking for