InDesign script to find a superscript

Am very new to javascript scripting with InDesign CS4. A simple question: What would I put in a FindChangeList text file in order to find superscript text? Have tried numerous variations without success. Thanks in advance.

use
{position:Position.superscript}

Similar Messages

  • InDesign Script to find images w/ prefix code, place img on page along with file name.

    Hello,
    I'm looking for an InDesign script that will prompt me for a code/text, this code/text will be the prefix of images in the sever, and then return the images found with this prefix by placing them on the document page and also display their file names in a text box. Is there such a script out there that anyone recommends. Thank you for your help. I'm on a Mac, using InDesign CS6, Javascript or any other would do.

    Hello,
    I'm looking for an InDesign script that will prompt me for a code/text, this code/text will be the prefix of images in the sever, and then return the images found with this prefix by placing them on the document page and also display their file names in a text box. Is there such a script out there that anyone recommends. Thank you for your help. I'm on a Mac, using InDesign CS6, Javascript or any other would do.

  • Indesign script to find and replace from external excel file

    I have been asked to update an existing price list (set up as lots of small tables) in Indesign (500+  pages). I have been given a new Excel spreadsheet with the product codes and new prices. I am looking for some assistance on finding or creating a script that can do such a thing if at all possible to speed up the process over just copying and pasting. Does anyone have any suggestions or point me in the right direction?

    1. Your Excel conversion to FindChangeList format idea seems okay, apart from one thing: both findWhat and changeTo strings should have double quotes around them. As they are now,
    grep {findWhat:lang1"} {changeTo:"lang2} {incl...(etc.)
    the opening one after findWhat and the closing one after changeTo are missing.
    2. Your first line contains 2 definitions. Each separate definition should be on a line of its own. (This might occur elsewhere as well, didn't check.)
    3. Any double quotes inside strings will cause problems. Precede them with a backslash to 'escape' them and convert them to a literal character. I found this one:
    "(for IC5/8"V)"
    -- change to
    "(for IC5/8\"V)"
    4. Some of your strings start with double double quotes:
    changeTo:""(MITM刀具见254页 ...
    5. To prevent your problem with this order
    grep {findWhat:Inserts"} ...
    grep {findWhat:Inserts Ordering Code System"} ...
    sort your Excel list alphabetically, case preserving, in reverse order.
    You probably also want wholeWord:true, and caseSensitive:true.
    Hope this helps!

  • Script to find word stacks in InDesign

    CS6, InDesign -- I've been looking for a proofing script that finds word & letter stacks and highlights items found & would be easily removed once items have been reconciled.

    While this scripting forum is a great place to get scripting help, it's also very easy to misuse it. Please bear in mind that for most (if not all) of the participants here, writing scripts is a source of income. If someone writes a particularly useful script, don't be shy to offer money (privately)! Also, please do not expect that complete scripts will be written for you (although in many cases they will be). If you are a novice scripter and show an interest in learning, you will generally find that the help you recieve will be much more positive.
    Here's a short list of "Dos" and "Don'ts" to keep in mind...
    Do ask for help in automating your work in InDesign, but Don't expect a full solution for free.
    Do show an interest in learning, and people will probably try to help you, butDon't ask for other people to solve all your problems for you.
    If you need a script written for you, Do ask if someone is available to write one for pay, but Don't keep such an issue on the forum. Work it out off the forum please.
    Please Do thank others who spend the  time to solve your issues, and pleaseDon't expect every issue to be solved on a public forum. Many solutions have  taken a lot of programming time to work out, and it's not reasonable to  expect such solutions to be given away for free.
    Please Do give code examples to help other people, but please Don't pass off others code as you own!
    Please Do make a note in the topic of a new thread of what language you are using as well as the version number that you are using such as: [JS][CS3].
    Please Don't branch off a discussion in the middle to a new topic -- please start a new one!
    Please Don't start two discussions on one topic -- it makes it very confusing!

  • Running scripts from Finder, and printing without a dialog

    Two questions:
    1. I need to launch an InDesign script from outside of InDesign -- such as launching the script from the finder (Mac) and having it run in InDesign. How can I do this?
    2. How can I script printing a document so that it automatically prints, bypassing the Print dialog box that a user would need to click on (I want it to print automatically in the background without the user doing anything)?

    1. Just save your script as an application and wrap your stuff in an "on run" statement.
    on run
    tell application "Adobe InDesign"
    --do stuff
    end
    end
    See the Applescript Language Reference at developer.apple.com/applescript for more info.
    2. Yup. The "do stuff" in your case will probably look something like this:
    tell active document
    --Set up options, assumes you have created a printer preset
    -- with the output options you want
    set active printer preset of print preferences to "my printer preset"
    set page range of print preferences to all pages
    --And then print
    print without print dialog
    end

  • Indesign Scripting Object Model

    Hi,
    Is there some reference documentation that provides detailed information on the Indesign object model as exposed to the scripting interface (javascript)?
    I have done fair amount of scripting in Illustrator so I was looking for the Indesign equivalent of this document
    http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/illustrator/scrip ting/illustrator_scripting_reference_javascript_cs5.pdf
    I looked at this document but it seems kind of sparse (compared to illustrator)
    http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/products/indesign/pdfs/InDes ignCS5_ScriptingGuide_JS.pdf
    Obviously they are different applications but I was kind of hoping there would be more info for Indesign scripting.
    In particular I am looking for some insight on how to effectively walk or traverse the document structure of an indesign document using code.
    Finding specific things by type seems out of the picture becuase after doing object reflection on all the page items in an indesign document nothing seems to have a "type" property.
    In my illustrator scripts I was able to place stuff in illustrator layers, give arbitrary pageitems a name and then later go find and manipulate via script. Not as clear how to do this in an indesign context.
    The one advantage of this was that in illustrator I was able to use textframes to hold variable data and read later via scripts. The document becomes the database. And I could create any number of arbitrary "variables" inside the document outside the white board. WOndering how to do this kind of stuff with indesign so I can do template driven documents that are managed by scriptings and form UI that I create.

    commnet: Glad to hear you're clear on the new keyword. It's something that a lot of people are confused about.
    Also glad to hear you've read Crockford's book on this stuff. Honestly I think for most InDesign usage, it's a mistake to worry about any kind of inheritance...usually it's easier to ignore all that stuff.
    And to answer the question about number of properties, probably talking max 100 or so. Certainly not thousands. I just want to have my own datastructure embedded in the indesign document that I can easily talk to via scripts. And this data needs to persist between instances of the javascript script's lifecycle. So it seems having some XML to parse is the solution. If that makes sense.
    If there was a way to deal with JSON data "hidden" within an indesign document I would gladly work with that. But I still need to change certain common content snippets inside the flow of the indesign document in a consistent way.
    I think if you have max 100 properties, you should probably choose the methods that are clearest code, rather than most efficient. I suppose you might have noticable delay with 100, though, obviously try it and see. I'm confused but I thought you needed to have your data associated with text elements inside your document, such that it is visible to a user in the user interface. Hence the proposal of using XML tagged text inside a Text Frame. Did that requirement go away?
    If you just want to hide JSON in the document, then use document.insertLabel() of a string of JSON and be done with it.
    You can also use the JavaScript interpreter's E4X features, that give you much richer Javascript bindings for manipulating XML objects and files. Unfortunately the Javascript's XML bindings have nothing to do with the InDesign XML object model. So could, e.g., export the InDesign DOM XML into a file, read that into a Javascript XML object, manipulating with E4X functions, write it out to a file, and then re-import it into the DOM. Not really very convenient.
    I honestly don't know much about Javascript for browsers, so if you could be more concrete in your queries it would be easier to answer.
    Looking forward to your example snippet though.
    OK, so, in Jeff (absqua)'s example, you create a constructor for a changeNumber rule, you call the constructor to make a rule, add the rule to the ruleset, and change a value attribute of the rule, and then process the ruleset.
    This strikes me as...extremely goofy. For two reasons, first the ruleset creation function should be parametrized with the value you want to change, and second, that you go change the rule's attributes after you have added it to a ruleset. Also, while this works in this example, I don't think it's appropriate to have the xpath attribute hardcoded in the rule creation function -- it's much plausible that you want a function that constructs a rule that changes some arbitrary tag to some arbitrary value.
    So, anyhow, if you were going to stick with the constructor paradigm, then I would change from:
    var changeNumber = new ChangeDocumentNumber();
    var ruleSet = [changeNumber, changeDescription];
    changeNumber.value = "5678";
    __processRuleSet(doc.xmlElements[0], ruleSet);
    to:
    var changeNumber = new ChangeDocumentNumber();
    changeNumber.value = "5678";
    var ruleSet = [changeNumber, changeDescription];
    __processRuleSet(doc.xmlElements[0], ruleSet);
    But I don't like this, because it's not parametrized reasonably. I would want something like:
    var changeNumber = new ChangeValue("//DocumentNumber", "5678");
    var changeDescription = new ChangeValue("//DocumentDescription", "New descr.");
    var ruleSet = [ changeNumber, changeDescription ];
    But because of my disdain for classical inheritance in JavaScript, I would instead write it as:
    function changeValue(xpath, newValue){
      return {
        name: "ChangeValue",
        xpath: xpath,
        apply: function(Element, processor) {
          if (newValue) {
            element.contents = newValue;
          return true;
    var changeNumber = changeValue("//DocumentNumber", "5678");
    var changeDescription = changeValue("//DocumentDescription", "New descr.");
    Because I think that a lot clearer about what is going on without introducing confusion.
    Edit: removed "this.value" from the above and just used newValue directly.
    But if you're defining a lot of rules with different apply functions, this is a very cumbersome strategy. You have all this boilerplate for each function that is basically the same but the apply function is different. This is leads to a lot of wasted code duplications. Why would your apply function be different? Well, that would usually be if you are writing functions that move around XML elements within the document hierarchy, or other things that are not simply changing the value of an element.
    I would much prefer to write this as:
    var changeRule = makeRule("change",
      function(element, ruleProcessor, newValue) {
        element.contents = newValue;
    var changeNumber = changeRule("//DocumentNumber", "5678");
    var changeDescription = changeRule("//DocumentDescription", "New descr.");
    var ruleSet = [ changeNumber, changeDescription ];
    This kind of syntax makes it much more compact to create arbitrary rules with different apply functions. In retrospect, the makeRule() function is named wrong, because it returns a function that makes a rule. Perhaps it'd be more reasonable if it was called makeRuleMaker().
    Anyhow, the downside is that the makeRule() function is kind of heinous. I wrote this in March in Re: How to shift content with in cell in xml rules table. But:
    //// XML rule functions
    // Adobe's sample for how to define these is HORRIBLE.
    // Let's fix several of these problems.
    // First, a handy object to make clearer the return values
    // of XML rules:
    var XMLmm = { stopProcessing: true, continueProcessing: false};
    // Adobe suggest defining rules constructors like this:
    //   function RuleName() {
    //       this.name = "RuleNameAsString";
    //       this.xpath = "ValidXPathSpecifier";
    //       this.apply = function (element, ruleSet, ruleProcessor){
    //       //Do something here.
    //       //Return true to stop further processing of the XML element
    //       return true;
    //       }; // end of Apply function
    // And then creating a ruleset like this:
    //   var myRuleSet = new Array (new RuleName, new anotherRuleName);
    // That syntax is ugly and, and is especially bad if
    // you need to parametrize the rule parameters, which is the only
    // reasonable approach to writing reasonable rules. Such as:
    //   function addNode(xpath, parent, tag) {
    //       this.name = "addNode";
    //       this.xpath = xpath;
    //       this.apply = function (element, ruleProcessor) {
    //           parent.xmlElements.add(tag);
    //           return XMLmm.stopProcessing;
    // and then creating a ruleset like:
    //   rule = new Array (new addNode("//p", someTag));
    // So instead we introduce a makeRule function, that
    // allows us to leave behind all the crud. So then we can write:
    // addNode = makeRule("addNode",
    // function(element, ruleProcessor, parent, tag) {
    //     parent.xmlElements.add(tag);
    //     return XMLmm.stopProcessing;
    // and use:
    // rule = [ addNode("//p", someTag ];
    function makeRule(name, f) {
        return function(xpath) {
            var
                //xpath=arguments[0],
                   // "arguments" isn't a real array, but we can use
                   // Array.prototype.slice on it instead...
                   args=Array.prototype.slice.apply(arguments, [1]);
            return {
                name: name,
                xpath: xpath,
                apply: function(element, ruleProcessor) {
                        // Slice is necessary to make a copy so we don't
                        // affect future calls.
                    var moreargs = args.slice(0);
                    moreargs.splice(0, 0, element, ruleProcessor);
                    return f.apply(f,moreargs);

  • Location of InDesign scripts

    I'm trying to find the moved location of the InDesign zip archive of the scripts shown in the InDesign_ScriptingGuide_JS.pdf.
    Adobe lists this link in the pdf as
    http://www.adobe.com/products/indesign/scripting/index.html.
    but it just takes you to their InDesgin CC page.
    Thanks

    Try going down the page and in one of the side list is a link
    Resources
    Adobe Exchange
    Adobe Configurator
    Developer Center
    Automating InDesign
    Custom editorial publishing solutions
    Creative Suite Printing Guide
    Print production
    Click on the Automating InDesign and then the Scripting Resources.

  • Is there a script to find text and make a hyperlink? (CS4)

    I'm developing an online glossary for a book project. I would like to write a script for InDesign that will find all instances of a given text---let's say, "shoe"--and add a hyperlink to each glossary entry. Is this possible, or do I have to manually search across all docs in the book to insert links? My gut tells me there's a way, but I can't seem to put my finger on it. HELP!!!
    Sincerely,
    FrustratedEditorNerdTryingToTeachHerselfStuff 

    Yes, it should be possible. Here is a script that you could use as a starting point.
    Regards,
    Kas

  • Script a find/change using a datasource

    So I wrote a program (C#) a few years ago that basically opens an InDesign Exchange file, does a find/replace based on a SQL table datasourse and then our graphics folks would just convert the completed INX file back to InDesign and ultimately to a PDF.  Too many steps.
    There are upwards of 2500 pieces of variable data in each file, so a product like DesignMerge is not practical.  Our data file basically consists of 2 fields [LookFor] and [ReplaceWith], I'd like an Indesign script that will just run through the data file and do a Find/Change for each record.  Is this doable and does anyone have any suggestions or starting points?
    Thanks!

    Yes, it's possible. In my oppinion the easiest approach is to export your data to a csv-file and read it by script. I posted an example in this thread.
    However, on PC, it's also possible to exchange data directly between InDesign and Excel, or Access (without csv). I did some tests: the main (InDesign) part was written in JS. Another (Excel) part that opens a workbook, reads records and closes it was written in VB (it is sent from the main part via doScript method). The VB script reads all used ranges puts, them into a string and returns it back to the JS via ScriptArgs.SetValue method (JS gets the string by app.scriptArgs.getValue method).

  • Where are InDesign scripts?

    I've been looking through the forums for 10 minutes and cannot find a link to InDesign Script page. Where the heck is it hidden? Thx.

    Here's a bunch of links I've collected over the yonks
    http://www.kahrel.plus.com/indesignscripts.html
    http://www.adobe.com/cfusion/exchang...=5&l=-1&exc=19
    http://www.lynda.com/home/DisplayCourse.aspx?lpk2=46814
    http://www.danrodney.com/scripts/
    http://blogs.adobe.com/indesignchannel/scripting/
    http://www.kasyan.ho.com.ua/my_scripts.html
    http://www.indiscripts.com/post/2010...n-indesign-cs4
    You better bookmark them

  • Basic doubt in InDesign Scripting

    Hi All,
    I have little bit knowledge in InDesign Scripting, but i have not rectify the below error.
    Take an example,
    I want to move "Footnote" styled paragraphs to another frame or another document. I have followed the below steps.
    1. Find parastyle
    2. Matched para's assigned to array
    3. using the array i am going to move.
    In this logic, First para moved perfectly, but other paras are totally changed.
    It is happend because of para index changed at the time of moving. How to avoid this problem?
    Regards,
    sudar.

    findText() and its cousins have an optional argument to reverse the order of the results.
    At least that's what the object model says.
    Dirk

  • Script to find/replace regular to Italic based on search terms in .txt

    Sorry for such a newbie post.
    I have been reading on JS scripts for find/replace.  I'm hoping develop a script or find one that is written that
    1. Looks into a .txt or any searchable file format, containing search terms
    2. Script will run on the entire Indesign document
    3. For any matching search terms script replace the style from regular to Italic, or from Bold to Bold/Italic. 

    Perfectly doable. Do you want to give it a go yourself?
    A few first thoughts (things I'd probably solve myself while writing the script):
    1. JS can read any file, but getting just the plain text out of an MS Word document is kind of ambitious -- even for me. Keep it simple: if your search text is nothing but a list of keywords or short phrases, write them out in a plain text file, one search item per line.
    2. With that I presume you mean not on one single continuous story, but all over the file -- including loose text frames, master pages, and what-have-you-got. Thass' easy, you can set the target for a Find or Replace operation with pin-point accuracy.
    3. .. This is the interesting part, actually.
    (a) Do you want to change the text style? That will set an override "+" for the modified text. It would be safer (wiser, etc.) to change it using a character style. (For the script it doesn't matter which method you use, this is just for the Future You who is going to edit this file in 6 months.)
    (b) If you do use a character style: what should happen if there already is one applied? Not bold or italic, but underline, for instance. Applying a new char style will override this one.
    (c) The naive approach (which I probably would have taken first) is to first search for each of the search terms, go over the 'found' list and test for each single entry if it's in regular or bold, then take appropriate action.
    A better approach -- without knowing anything else about this document -- could be to blindly use Replace to change ALL search terms in "Regular" to "Italic" and ALL search terms in "Bold" to "Bold Italic". It sure would be faster.
    (d) Just like in the interface, you can search for a word and 'change' only the formatting -- no need to change the text as well. And just like in the interface, you need to specify "whole words" and/or "case sensitive".

  • Script not finding hyperlink source

    Extract to epub fails on hyperlinks and I have a problem trying to find and get rid of them. The hyperlinks only show up in story editor. I made a two page test ID file to narrow the problem. It has one of the problem hyperlinks and I can't find it with a script. I'm using a script mentioned in another hyperlink post http://forums.adobe.com/message/4629362#4629362
    The script is:
    objHyperLinks = app.activeDocument.hyperlinks;
    for (i=0; i<objHyperLinks.length; i++)
              if (objHyperLinks[i].source instanceof HyperlinkPageItemSource)
                        alert (objHyperLinks[i].source.sourcePageItem.id);
                alert('Hello World');
    I have the ID source, the script source, and an image of the entire story in story editor out in Dropbox at:
    https://www.dropbox.com/s/octqiftupzkfoiv/IndesignTestFile6.zip
    I'm on win xp, id 5.5
    Any help would be greatly appreciated. I'm brand new to indesign scripts so still working on getting to square one.

    The -sourcepath option takes a path ending in a directory. It should not
    contain "*.java" or any other file pattern. And it supplies the path to the
    root directory of the package directories, not directories contain source files.
    (I think it should have been named "packagepath".) It is mostly ignored\
    when passing in source filenames (like *.java).
    So try replacing this:
    -sourcepath .\com\SteveSystems\People\*.java
    with this:
    .\com\SteveSystems\People\*.java
    -Doug

  • Indesign Script for placing excel-file

    Hi all, I'm new to Indesign Scripting, and I'm hoping someone can help me with the following code:
    All I want to do is:
    open indesign file
    open excel file
    place excelfile as a table (with flow enabled)
    save document & export as PDF
    Thanks!
    //Define file to open
    var myDocumentFile = new File("/d/Projecten/Indesign Server/document.indd");
    //Define file to save
    //var mySaveFile = new File("/d/Projecten/Indesign Server/document_save.indd");
    //Define file to export
    var exportPDF = new File("/d/Projecten/Indesign Server/document_save.pdf");
    //Open xls-file to place as table
    var myExcelFile = new File ("/d/Projecten/Indesign Server/products.xls");
    var result = "";
    if(!myDocumentFile.exists) {
        result = "Unable to find DOCUMENT:  " + myDocumentFile.path;
        $.writeln(result);
        exit();
    } else if(!myExcelFile.exists) {
        result = "Unable to find EXCEL:  " + myDocumentFile.path;
        $.writeln(result);
        exit();
    } else {
        // Open file
        var myDocument = app.open(myDocumentFile);
        with(app.documents.item(0).pages.item(0)){
            myTarget = textFrames.item("tabel");
        var myPage = myDocument.pages.item(0);
        //Set excel placement properties
        setXLimportPrefs();
        // Place Excel file
           try {
                 $.writeln("Place Excel file");
                //HELP!! HOW TO PLACE EXCEL FILE?
                //myTextFrame.place(myFile);
            catch (e) {
                 $.writeln("Place Excel file "  + e + " " + app.excelImportPreferences.errorCode);
                myDocument.close();
                exit();
        if(!exportPDF.parent.exists && !exportPDF.parent.create()) {
            result = "Not exported.  Unable to create the folder:  " + exportPDF.parent.fullName;
            $.writeln(result);
        } else {
            app.documents.item(0).exportFile(ExportFormat.pdfType, exportPDF, app.pdfExportPresets.item("[Press Quality]"));
        myDocument.exportFile(ExportFormat.PDF_TYPE,exportPDF);
        myDocument.close();
    function setXLimportPrefs(){    $.writeln("setXLimportPrefs()");
            with(app.excelImportPreferences){
                //alignmentStyle property can be:
                //AlignmentStyleOptions.centerAlign
                //AlignmentStyleOptions.leftAlign
                //AlignmentStyleOptions.rightAlign
                //AlignmentStyleOptions.spreadsheet
                alignmentStyle = AlignmentStyleOptions.spreadsheet;
                decimalPlaces = 4;
                preserveGraphics = true;
                //Enter the range you want to import as "start cell:end cell".
                rangeName = "A1:B16";
                sheetIndex = 1;
                sheetName = "Appetizers";
                showHiddenCells = false;
                //tableFormatting property can be:
                //TableFormattingOptions.excelFormattedTable
                //TableFormattingOptions.excelUnformattedTabbedText
                //TableFormattingOptions.excelUnformattedTable
                tableFormatting = TableFormattingOptions.excelFormattedTable;
                useTypographersQuotes = true;
                viewName = "";
    result;

    "I just loaded a table into a text frame but it still contains nothing". I wonder how I'd check that, actually.
    @Jongware:
    To prevent this situation you could set the max. allowed cell height below your min. text frame height.
    If this is not applicable, because in some situations you cannot know the usable text frame height beforehand, you can iterate through all your set rows and check if the parentTextFrames[0].parentPage.name property of the first insertionPoint of its first cell is defined. If it's undefined and your last text frames parentPage.name is not equal to the last defined parentPage.name of your check your table will remain overset.
    Thinking about that method I must admit, that you can get a false positive, if a text wrap object on an applied master page comes into play…
    So no, I see no fail-safe check for this situation.
    Uwe

  • Update IDML with indesign script?

    Hello,
    In an Indesign Script (javascript), after I loop through the page items and find the text frame I wish to edit, I am wondering if it is possible get the IDML from that TextFrame, and then update it, and replace its current IDML with the updated version.
    I only will need to update one of the Story.xml files within the IDML package. Is this possible?
    Thanks in advance!
    -Lloyd

    @Lloyd: by thinking more deeply of your task, it seems to me, that you will go the following route:
    You start with an existing IDML file you want to manipulate (you stated so by choosing the title of this thread by "Update IDML"), no need to change the source:
    1. Unpack the IDML file with scripting (see "unpackageUCF (ucfFile: File, destinationFolder: File)" in the documentation)
    2. Do your stuff
    2.1 search all story.xml files for your text string and it's parent story you want to change or by identifying your story using "idmlComponentName" on the source
    2.2 do the change by reading and writing the xml-file
    3. Repackage the IDML file and give it a new name (see "packageUCF (sourceFolder: File, ucfFile: File)" in the documentation)
    However, if you want to place an updated snippet, you can use the place command as usual; be aware that there are additional options in preferences to export and place a snippet to confirm to its IDML-format during export and there is a "place in original location" option for placing:
    DocumentPreferences: snippetImportUsesOriginalLocation
    application: snippetExportFormat: SnippetExportFormats.INX_EXPANDED_FORMAT (for generating an IDML-snippet instead of an INX-snippet)
    Uwe

Maybe you are looking for