Script Export single Pages with the name and file custom paragraph Style?

I have a document called "mydocument".

I have a several pages in the document.

Each page has a title of"style with a stylesheet called point title.

I need to export each page as individual .jpg with a custom file name

myDocument-01 - title.jpg

01 is the page number

Seemed like a simple request... but it turns out that it's a little challenging.

This scipt below, that I found on another thread a little work

It gives me a

Title1.jpg

But I can't figure out how...

1. Add the name of "mydocument".

2. have a 0 on the 1-digit numbers

Can someone please guide me, I would be eternally grateful.

if (app.documents.length != 0) {
     var myDoc = app.activeDocument;
    MakeJPEGfile();
}
else{  
     alert("Please open a document and try again.");  
} 


function MakeJPEGfile() { 






     for(var myCounter = 0; myCounter < myDoc.pages.length; myCounter++) {

          if (myDoc.pages.item(myCounter).appliedSection.name != "") {
               myDoc.pages.item(myCounter).appliedSection.name = "";
          }
            
            var myPageName = myDoc.pages.item(myCounter).name;
          var myJpegPrefix = "";
          var isStyleExist = true;

          //Checking the existing of the paragraph style (filename)
          try {
              myDoc.paragraphStyles.item("title");
          }
          catch (myError) {
              isStyleExist = false;
          }

          if (isStyleExist)


          myJpegPrefix = getParagraphContent(myDoc.paragraphStyles.item("title"), myDoc.pages.item(myCounter)) + myPageName;
          app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.high; // low medium high maximum
          app.jpegExportPreferences.exportResolution = 72;
          app.jpegExportPreferences.jpegExportRange = ExportRangeOrAllPages.exportRange;
          app.jpegExportPreferences.pageString = myPageName;


          var myFilePath = "~/-client/JOYS - Just Organize Your Stuff/-Art/-art-book-kindle/" + myJpegPrefix + ".jpg";
          var myFile = new File(myFilePath);
          myDoc.exportFile(ExportFormat.jpg, myFile, false);
     }
}


// The new function, but needs to add checking the file name rules.


function getParagraphContent (paragraphStyle, currentPage)
{
    var paragraphContent = null;
    for (var c = 0; c < currentPage.textFrames.length; c++)
    {
        for (var i = 0; i < currentPage.textFrames.item(c).paragraphs.length; i++)
        {
            if (currentPage.textFrames.item(c).paragraphs.item(i).appliedParagraphStyle == paragraphStyle)
            {
                paragraphContent = currentPage.textFrames.item(c).paragraphs.item(i).contents;
   // Remove spaces and returns at the end:
                paragraphContent = paragraphContent.replace(/\s+$/, '');
   // Replace remaining spaces with hyphen:
                paragraphContent = paragraphContent.replace(/\s+/g, '-');
   // Make lowercase:
                paragraphContent = paragraphContent.toLowerCase();
                return paragraphContent;
            }
        }
    }
    return paragraphContent;
}

Thank you Mi!

One more step.

I just need to remove the extension .indd.

My file name is now

myDocument.indd - 01 - title.jpg

If (app.documents.length! = 0) {}

myDoc var = app.activeDocument;

MakeJPEGfile();

}

else {}

Alert ("Please open a document and try again.");

}

function MakeJPEGfile() {}

for (var myCounter = 0; myCounter< mydoc.pages.length;="" mycounter++)="">

If (. appliedSection.name myDoc.pages.item (myCounter)! = "") {}

myDoc.pages.item (myCounter).appliedSection.name = "";

}

var myPageName = myDoc.pages.item (myCounter) .name;

var myJpegPrefix = "";

var isStyleExist = true;

Audit of the existing paragraph style (filename)

try {}

myDoc.paragraphStyles.item ("title");

}

{} catch (MonErreur)

isStyleExist = false;

}

If (isStyleExist)

myJpegPrefix = getParagraphContent (myDoc.paragraphStyles.item ("title"), myDoc.pages.item (myCounter)) + '-0 "+ myPageName;

app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.high; low medium high maximum

app.jpegExportPreferences.exportResolution = 72;

app.jpegExportPreferences.jpegExportRange = ExportRangeOrAllPages.exportRange;

app.jpegExportPreferences.pageString = myPageName;

var CheminMonFichier = "" ~/-client/JOYS - just organize your Stuff Art / /-art-book-kindle / "+" / "+ myDoc.name +"-"+ myJpegPrefix +".jpg";

var myFile = new File (myFilePath);

myDoc.exportFile (ExportFormat.jpg, myFile, false);

}

}

The new feature, but it will add filename rules checking.

function getParagraphContent (paragraphStyle, currentPage)

{

var paragraphContent = null;

for (var c = 0; c)< currentpage.textframes.length;="">

{

for (var i = 0; i)< currentpage.textframes.item(c).paragraphs.length;="">

{

If (currentPage.textFrames.item (c).paragraphs.item (i) .appliedParagraphStyle is paragraphStyle)

{

paragraphContent = currentPage.textFrames.item (c).paragraphs.item (i) .silence;

Remove the spaces and returns at the end:

paragraphContent = paragraphContent.replace (/ \s+$ /, ");

Replace the remaining spaces with hyphen:

paragraphContent = paragraphContent.replace (/ \s + / g, '-');

Make lowercase:

paragraphContent = paragraphContent.toLowerCase ();

Return paragraphContent;

}

}

}

Return paragraphContent;

}

Tags: InDesign

Similar Questions

  • Export PDFs single page with the name of the page

    I was looking for a script that:

    -exports all the pages of an indesign file to PDF separate single page (or other file types)

    -names, the pdf file with the name of a page-> This is the hardest to find part

    The reason why I could use it: I have a file of 200 + page with productspecs. I would like to export all pages with the software "productName" correct. (extraction of a PDF file in acrobat is not a problem, but then I have to rename all the files manually)

    I do not know how to name pages, because it is not a function in indesign. Ideal would be to be able to 'say' indesign: this textframe = the name of the page, then it would be not necessary to label the page separately.

    I'm not a writer. I searched the forum and found some info on this already, but not a working including automatic pagenaming script.

    I found an old post where someone points to such a script, but I'm not:

    http://www.techplex.NET/postsm40018_possible-to-name-pages.html#post40018

    Do you have someone at - it never/found/used such a script?

    (btw, a similar script for illustrator work plans would be very useful also!)

    Any help is appreciated!

    Zanelli Scott made a years. did a fantastic job.

    http://InDesignSecrets.com/page-exporter-utility-Peu-5-script-updated-for-CS3.php

    Loïc Aigon wrote a...

    http://www.loicaigon.com/blog/?p=876

    regarding work plans illustrator... don't know - have a look at the forum of illustrator scripts.

  • find a block of text on the page with the name of script

    Hi all

    I need to create a script for

    find a block of text on the page with the script titled "xxx".

    and read its contents into a variable.

    The content of the text block is a number.

    Thank you

    Hello Roberto,

    Welcome to the forum,

    This is the textFrame marked on the current page.

    var myLabel = "Foo", // change to label
          myPage = app.properties.activeWindow && app.activeWindow.activePage,
          myTextFrames = myPage.textFrames.everyItem().getElements().slice(0),
          l = myTextFrames.length,
          myVariable
    
    while (l--) {
        if (myTextFrames[l].label != myLabel) continue;
        myVariable = myTextFrames[l].contents;
        break; // presuming there's only one "Foo" labeled frame on the page
        // Otherwise you'll nead an array
        }
    
    alert(myVariable)
    

    Trevor

  • srvrmgr syntax: How can I create subsystem named with the name and Description of the values?

    Looking through the library, he did discuss are of syntax that allows you to include the value of name and the named value of the Description of a subsystem/Profile Configuration.  In the screenshot, the circled values were created with the server online order Manager.

    NamedSubsystems.gif

    On the other hand, pouvez create a definition of the element with a name (full name) and a Description.

    For CompDef, it works:
    create the CompDefTest1_enu component definition for the type of component AppObjMgr component fins group run mode interactive full name 'Test Comp Def Test 1' description 'Test 1 CompDef Manager object.

    For named Subsytem, it does NOT work:
    create named subsystem Test5 subsystem EAITransportDataHandlingSubsys full name 'Test 5' description 'Test 5 Description'

    Someone can tell me if there is a good for a named subsystem, syntax to include the name and Description of the values in the command line, or is the only way to create it manually in the UI?

    Hello

    I spent reviewing aid to create the order in srvrmgr, it does not give the full name and description as parameters for the creation of subsystem. However, as you noted these settings are available for creating components definition:

    srvrmgr > help to create

    Create {component group | compgrp}

    [full name: ]

    [{description | desc} ]

    create {definition component: compdef}

    for {component type | comptype}

    {Component group | compgrp}

    run in mode {batch | interactive | background}

    [full name: ]

    [{description | desc} ]

    [with [ param =[, =...]]]

    [[fixparam =[,...]]]

    create the subsystem named for

    subsystem with = [,...]

    Shelf also has an example of creation of subsystem that doesn't include no description, name and first name:

    http://docs.Oracle.com/CD/E14004_01/books/StoreFwdMsg/StoreFwdMsg_InstallConfig14.html#wp1351472

    In this case I suggest that allows you to create a ticket on My Oracle Support to confirm this srvrmgr does not support the creation of a new subsystem with the full name and description settings and request an enhancement for these settings include request in create statement for new subsystems when using srvrmgr.

    It will be useful,

    WSiebel

  • Querying the oracle table that has a column with the name of "FILE".

    Hi all

    I need to have an oracle table that has the column with the name "FILE".

    I can query all columns with the query "select * from table".

    But I'm not able to use the query "select the table file.

    This table is converted from ms access to oracle and I need to have this column with the name "FILE".

    Any suggestions?

    Thank you

    Abdellaoui

    Hello

    FILE is a keyword from Oracle, so it's not a good name,

    Use FILEDATE, or DATE_FILED, or something else that is not in V$ RESERVED_WORDS. KEYWORD as the name column.

    If you need to use the FILE, then you must use quotation marks.

  • create file with the name of file with today's date

    Hello
    is it possible to create a file with the current date? In fact, I want to take backup of my oracle schema every day with the name of the file including the date...

    You can use the syntax below,

    exp = orcl_ file ' date of +%Y%m%d%%H%M%'.dmp

    Thank you

  • Export a page to the photoshop/illustrator file with the same structure of layer?

    Hello

    Currently freelancing for a company that create using the indesign work and I try to streamline the process of splitting the outside inside work is separate to import directly into damage layers. I know you can use a script to separate the outside layers and then export as interactive pdf, this opening in illustrator and then releasing to layers (build) I'm looking for an effective way more time to get to this point? Sometimes the work does not seem to import correctly into illustrator, because there clipping masks and weird stuff out there (their marketing team is huge and those working on the same things that make things way differently). I tried two script to split the work out in components, but they don't seem to not remember the position or just produce the element of the unique work.

    A typical file would be 640 x 640 page with multiple Indesign pages with 6 layers of each placed exactly and signed illustration of positional for. The perfect scenario would be to run a script to export directly into photoshop (keeping the culture and position) if it is then just one case to draw only a file directly in ae.

    There are various forums and I got asked in all of scripts but InDesign and in particular script is not my forte. It is one that could do the trick, but the link is no longer active: http://www.zenodesign.com/forum/PageToPSLayersV3.zip

    I know it may seem as it is lazy, but there are many things to animate by project in different sizes, so any help and pointers would be great!

    Thank you

    A

    It is one that could do the trick, but the link is no longer active:

    The latest version is here. This is an AppleScript script if OSX only:

    http://www.zenodesign.com/Forum/PageToPSLayersV7.zip

    If you have any questions see this thread:

    How to export indesign layers in photoshop (same structure) layers

  • Script to reorganize pages with the bookmark?

    I just realized that the order of bookmarks does not reflect the order of the pages.

    Y at - it a script of third party who will treat bookmarks under "topics" and rearrange the pages according to the order of bookmarks?  (By analogy, Microsoft Word allows the user to rearrange the document easily by drag-and - drop topics.) "I think it's one of the most powerful tools for editing of speech.)

    I bet it's possible with the plugin Evermap's AutoBookmark, but it's probably also possible with a script (which is usually cheaper than a plugin.

    If you are interested in such a script in development for you, feel free to contact me privately.

  • Print the PDF document with the name and the date and time of printing from the printer

    Hello

    I am fairly new to this...

    I have a PDF document and when I print it, I want the name of the printer and the print date/time to be shown on the printer output.

    I have several printers (some common and some on the network) and do not necessarily use the default. I would like the name of the printer used to be printed on the document.

    With : var = this.getField ("Printer"); h.value = app.printerNames; I am able to get the list of all available printers, but I just need one that is used.

    For the date and time, using the var f = this.getField ("Today"); f.value = util.printd ("j/mmm/yyyy", new Date()); gives me the time of when the document is opened, not when the document is printed. (or maybe I'm missing something?)

    I guess the question of the date/time is not major, because there is usually not much difference between the time that you open the document and the time you print it.

    I'm more interested in the name of the printer.

    I use Acrobat 9 Pro to edit my PDF document.

    Can someone help me please?

    Thank you!

    The name of the printer is a property of the PrintParams object. This property is updated before the PDF is sent to the printer and the name of the printer selected catalogue user interface is available in the ' Will Print' event.»

    In the document 'Will Print' action, you can use:

    pp var = this.getPrintParams ();
    this.getField('PrinterName').value = pp.printerName;

  • Compaq Presario desktop XP-problems connecting / came with the settings and files of the previous owner

    My Director ex-chorale of the Church and his wife (was his computer) moved to Minnesota and gave me this Compaq Tower and the monitor speakers.  She cleaned me all of hers off the coast.  Well, she didn't.  She switched to the network connection and modem.  I'm low on memory.  Help support & the beginning, Compaq support and connections says "unable to connect to the server."  I have fast Internet with Comcast cable.  His modem is Gegere or something and the network connection is RealTek 97 Fast family and mine is Arris (modem).  Specifications of the computer:

    XP Edition family c. 2002 SP3

    Compaq Presario Intel inside Celeron (R)

    CPU 2.53 GHz

    248 MB of RAM

    CD player works but the DVD player does not open.  Connection is so slow that it takes 5-10 minutes to open anything.  IE8 gets constantly "stops responding."  Just like Firefox.  When you try to close a window or stop start, end the program box comes back and comes back again and again.

    Went to start-help & support-Compaq help and did some tests.  For Audio, etc. get: "Exception in DisplayRunMap.runmap.

    Only had this computer for 2 weeks and did nothing to save.  Can reinstall Norton Security Suite for Comcast and my Microsoft Professional 2007 from a cd.  Thought to do the system recovery.  This OS came with Compaq and recovery CD system recovery option and there is F - 10 System Recovery on initialize toward the top.  Are they the same?  I first have to install Windows XP on a bunch of CD?  Can't make a DVD if the drive does not open.  The button is loose and nothing happens.

    I am 63 and security social disability so can not afford a new computer, or to hire a technician.  Help, please!

    When you request support, please provide the number full name or product model of the HP computer in question. HP/Compaq made thousands of computer models. Without this information, it can be difficult, even impossible to help you solve your problem.

    The above requested information on the side, back, or bottom of your computer. , Please do not include your serial number.

    The 'F10' and Compaq system recovery of Windows XP system recovery are the same thing. You don't need to create "HP recovery discs" before making a recovery, but you may need these disks at a later date. If a set of disks has already been created, you will not be able to create a second series and you may need to buy a game from a third-party vendor.  With the complete model number name and/or product will allow us to direct you to a place to buy these records, if necessary.

    Please click the White Star of KUDOS to show your appreciation

  • Red screen on the page with the embedded swf file

    My application refused:

    I am testing your app on the BlackBerry Dev Alpha Device (OS version 10.0.9.1675). When I try to open the sub category of your app, it's only showing a red blank screen appears and does not respond.
    

    It works very well in ripple, but I can't get the Simulator working and I don't have an alpha of dev, so I can't test it myself. The subcategory is just a HTML with a built-in .swf file.

    Download the full source code

    Any suggestions?

    Hello

    You have this function in your config.xml file?

  • menu on mobile for the single page of the site

    We all know that to make a single page site menu buttons must be added manually and link to anchors placed on several spots on the page.

    Lets say I have 1 HOME 2 ABOUT ME and CONTACT me. 3 and each of them has an anchor with the names and the same order.

    If I select ' about me ', then the menu button/item will be selected (active) - which is something I don't want to - but point menu 'home' will remain as active, because we had its anchor in position for the second one (aboutme) - which is something I don't want to...

    So... what should I do?

    Hello

    Sorry for the late reply. I checked your file. The reason why the tab 'Business' did not become active and "About Me" remained active even when clicking on the tab 'Business' is that the height of page was not long enough. If the anchor 'Business' was not to the top of the page where the tab would become active. I have increased the height of the page, and he began to work as expected. As it is a mobile site, the page size should be sufficiently seen mobile screens are smaller. States should work on mobile phones, even with the specified height. For the test, you can increase the height.

    See you soon!

    Aish

  • PDF form: allow the customer to enter the name and address in a printable letter

    I am creating a letter in which people can:

    -Download in PDF from my Web site

    -Open in an application PDF and enter their name and address

    -Print the letter with the name and address (that they registered above) inside.

    I'm assuming that InDesign CS6 is the best tool for this because it has orders to create interactive PDF Forms.

    I created a text box for the user to enter their name and address. I then went to window > interactive > buttons and form, clicked on the box and he attributed the following values:

    -Type: Textfield

    -Event: Onfocus (PDF)

    PDF options: Printable, necessary, Multi line, scrollable

    I then export my PDF making sure to put ' the interactive elements' "of appearance."

    When I click on the text box, on the Mac or Acrobat preview, nothing happens.

    What I am doing wrong?

    Thanks for any help.

    Use file > export > Interactive

  • When the page opens, the scroll bar appears only if I move to bottom of page with the mouse

    It started last week with Firefox 5 and continues with the upgrade to Firefox 6. Each new page that opens in Firefox does not display a scroll bar. By entering the lower right of the page with the mouse and move the mouse to the right, the scroll bar appears and is usable. This "correction" is required on each new page.

    This condition looks similar to the condition met when Firefox 5 was introduced. The fix was to open appearances in tools then choose the default setting. This patch doesn't work anymore.

    Troubleshooting extensions and themes

    Check and tell if its working.

  • Hello, I recently created a website for a client. I also created a brochure with a QR code that automatically redirects visitors to a single page in the site. Well, I had to make changes to the site and I had to change the name of the page in which t

    Hello, I recently created a website for a client. I also created a brochure with a QR code that automatically redirects visitors to a single page in the site. Well, I had to make changes to the site and I had to change the name of the page in which the QR code pointing to. Is it possible to keep the current name of the page but create a page of automatic redirect named like the QR code? Basically, the brochures have all been printed already, so I need the QR code when analyzed in order to continue working. Now, it is not the case.

    Nevermind, I figured it. I've reproduced the page, renamed the QR that indicates the code of the page, and then he hid in the menu of page properties.

Maybe you are looking for