UndoModes.AUTO_UNDO

Hi guys!

While trying to debug a script missbehaving I made on this cancellation mode.

Can someone tell me what is its role? How is this different/similar form UndoModes.ENTIRE_SCRIPT?

When you run a script in UndoMode.AUTO_UNDO, ID add cancellation of the script to the previous element of cancellation on the undo stack. If there is no previous item cancellation on the stack, it seems that you will not be able to cancel the action of your script.

For example, after you manually create a new rectangle, edit > cancel displays 'Cancel add a new item.

If you then run the script (all in automatic cancellation mode) which turns off the visibility of a layer, Edition > cancel poster always 'Cancel add a new element' - even after your script has run.

If you are editing > cancel ("cancel add a new item") once your script is run, not only the creation of the new rectangle will be cancelled, will be so your layer settings. The cancellation for the layer settings occur as well as the cancellation of previously created.

Here is a script that you can run after you have created a new rectangle (or other) and see how it does not affect the top item of the undo stack, after it is performed. After you run the script below, you will see that the script changes are cancelled with as well as the previous cancellation.

// Make sure the frontmost doc has a layer named, "Layer 1" before running this script.
app.doScript(ChangeLayerFunc, ScriptLanguage.javascript, undefined, UndoModes.AUTO_UNDO, undefined);
function ChangeLayerFunc()
{
     app.activeDocument.layers.item("Layer 1").visible = false;
}

I hope this helps!

-Jim

www.premediasystems.com

Tags: InDesign

Similar Questions

  • You can attach a file selection in a mall in "Outlook" and then send to an address to specify?

    I've been looking around and try to find ways to do the following with extendscript:

    1. open "Outlook."

    2. create a new mail

    3. attach files that has been selected in an email, and then send an address to specify

    Is this possible?

    I found what it dose for MAC but I need to do in a windows platform

    Hi John

    Well isn't a question very inDesign is it but this will do what you want.

    // Send selected files as attachments through outlook on windows
    // By Trevor htps://forums.adobe.com/message/6546861#6546861
    // Need a custom script , willing to pay for it send me a private message.
    
    var notify = true; // set to true if you want a popup measage to say that the mail is sending
    var delay = 1.5 // the number of seconds you want the popup to appear
    var ToAddress = "[email protected]"; // You might need to change this
    var MessageSubject = "Howdy Barack, take a look at this"; // You might need to change this
    // bodyText set at line 27 Below
    
    var myAttachments =  File.openDialog ("Select the files you wish to attach", "All Files: *.*", true);
    if (!myAttachments) {
        alert("Sorry mate I can't send your attachments if you don't select them\rPlease try again next year\rThanks");
        exit();
    }
    
    var n, MessageAttachments = [], bodyFileNames = [], fName = "";
    for (n = 0; n < myAttachments.length; n++) {
        fName = myAttachments[n].fsName;
        MessageAttachments[n] = 'newMail.Attachments.Add("' + fName + '")';
        bodyFileNames[n] = fName;
    }
    MessageAttachments = MessageAttachments.join("\r") + "\r";
    bodyFileNames = bodyFileNames.join("\" & vbNewLine & \"");
    
        // the \" & vbNewLine & \" is a way off putting in line feads
    MessageBody = "Howdy i spent yonks of time making this. \" & vbNewLine & \"" + bodyFileNames; // You might need to change this
    
    //VBS code very very very heavily based on the answer of ShaddowFox333 http://www.tek-tips.com/viewthread.cfm?qid=728333  
    
    myVBS = '''Dim ToAddress
    Dim FromAddress
    Dim MessageSubject
    Dim MessageBody
    Dim MessageAttachment
    Dim ol, ns, newMail
    ToAddress = "''' + ToAddress + '''"
    MessageSubject = "''' + MessageSubject + '''"
    MessageBody = "''' + MessageBody + '''"
    Set ol = CreateObject("Outlook.Application")
    Set ns = ol.getNamespace("MAPI")
    Set newMail = ol.CreateItem(olMailItem)
    newMail.Subject = MessageSubject
    newMail.Body = MessageBody & vbCrLf
    newMail.RecipIents.Add(ToAddress)
    ''' +
    MessageAttachments + "newMail.Send";
    
    try {
        app.doScript (myVBS, ScriptLanguage.VISUAL_BASIC, undefined, UndoModes.AUTO_UNDO);
        if (notify) {
            var tempFile = new File (Folder.temp + "/" + +new Date + ".vbs");
            tempFile.open('w');
            tempFile.write('''Set shell = CreateObject("Wscript.Shell")
                        delay = ''' + delay + '''
                        shell.Popup "Sending document by outlook", delay, "InDesign Mail Manager", 64
                        Set fso = CreateObject("Scripting.FileSystemObject")
                        fso.DeleteFile("''' + tempFile.fsName + '''"),DeleteReadOnly
                        ''');
            tempFile.close();
            tempFile.execute();
        }
    }
    catch (e) {alert ("Drat goofed up")}
    

    Trevor

    OTT: Congratulations Uwe

  • Export and attach it in an email in "Outlook"?

    Hello everyone,

    I've been looking around and try to find ways to do the following with extendscript:

    1. open "Outlook."

    2. create a new mail

    3 attach a file to the mail

    Is this possible?

    I found what it dose for MAC but I need to do in a windows environment

    export and send the pdf script

    Thanks for your help there!

    Kind regards

    Ruy Ramos

    Hello Ruy Ramos

    This will send the document open in an attachment via outlook.

    Please mark as correct, thank you.

    Enjoy

    Trevor

    // Send open doc as attachment through outlook on windows
    // By Trevor https://forums.adobe.com/thread/1474664
    // Need a custom script , willing to pay for it send me a private message.
    
    var notify = true; // set to true if you want a popup measage to say that the mail is sending
    var delay = 1.5 // the number of seconds you want the popup to appear
    var ToAddress = "[email protected]"; // You might need to change this
    
    var doc = app.properties.activeDocument && app.activeDocument;
    if (!doc || !doc.saved) {
        alert("Sorry mate I can't send your document as an attachment if it's not saved or does not exist\rPlease try again next year\rThanks");
        exit();
    }
    
    var MessageAttachment = doc.fullName.fsName;
        MessageSubject = "Howdy Barack, take a look at this"; // You might need to change this
        // the \" & vbNewLine & \" is a way off putting in line feads
        MessageBody = "Howdy i spent yonks of time making this document. \" & vbNewLine & \"I called it " + doc.name; // You might need to change this
    
    //VBS code very very very heavily based on the answer of ShaddowFox333 http://www.tek-tips.com/viewthread.cfm?qid=728333
    
    myVBS = '''Dim ToAddress
    Dim FromAddress
    Dim MessageSubject
    Dim MessageBody
    Dim MessageAttachment
    Dim ol, ns, newMail
    ToAddress = "''' + ToAddress + '''"
    MessageSubject = "''' + MessageSubject + '''"
    MessageBody = "''' + MessageBody + '''"
    MessageAttachment = "''' + MessageAttachment + '''"
    Set ol = CreateObject("Outlook.Application")
    Set ns = ol.getNamespace("MAPI")
    Set newMail = ol.CreateItem(olMailItem)
    newMail.Subject = MessageSubject
    newMail.Body = MessageBody & vbCrLf
    newMail.RecipIents.Add(ToAddress)
    newMail.Attachments.Add(MessageAttachment)
    newMail.Send
    
    '''
    
    try {
        app.doScript (myVBS, ScriptLanguage.VISUAL_BASIC, undefined, UndoModes.AUTO_UNDO);
        if (notify) {
            var tempFile = new File (Folder.temp + "/" + +new Date + ".vbs");
            tempFile.open('w');
            tempFile.write('''Set shell = CreateObject("Wscript.Shell")
                        delay = ''' + delay + '''
                        shell.Popup "Sending document by outlook", delay, "InDesign Mail Manager", 64
                        Set fso = CreateObject("Scripting.FileSystemObject")
                        fso.DeleteFile("''' + tempFile.fsName + '''"),DeleteReadOnly
                        ''');
            tempFile.close();
            tempFile.execute();
        }
    }
    catch (e) {alert ("Drat goofed up")}
    
  • doScript (UndoModes) breaks InDesign Undo (CS4)

    I wrote a small script. To make sure that I can cancel it all of a sudden, I used:

    app.doScript (principal, defined, undefined, UndoModes.fastEntireScript, "My script");

    Once the script has completed, regular cancellation of InDesign is broken. It is no longer cancels distinct but only revert to the point steps until the script was run.

    What can I add at the end of the script to return things to normal?

    Thank you

    Ariel

    If you use try/catch in your script, you should probably use

    UndoModes.entireScript instead.

    The reason is little complicated...

    HTH,

    Substances

  • Help with script overset text?

    Hi, I found this script I think it is by Laubender. Which I use for a while now and I love it. It is easier to see where the blocks of text with overset text.  My Question is.  How would change this to get rid of the fill color of Magenta (perhaps with the original color of text box before the Script ran?) after the overset text is corrected

      app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;   
      app.doScript  
        (  
        detectOverflowingTextFrames,  
        ScriptLanguage.JAVASCRIPT,  
        [],  
        UndoModes.ENTIRE_SCRIPT,  
        "Detect Overflowing TextFrames | SCRIPT"   
        );  
        
      function detectOverflowingTextFrames() {    
      var storyArray = app.documents[0].stories.everyItem().getElements();  
      var storyArrayLength = storyArray.length;  
    
     // A loop through all the stories of the document:  
      for(var n=0;n<storyArray.length;n++)  
      {  
        // The condition should be clear.  
        // However, there is one rare case where overflows is false,  
        // but the text frame is showing a red + sign:  
        // If a footnote text overflows in the last frame of a threaded story.  
         
        if(storyArray[n].overflows)  
        {  
          // TextContainers could be textFrames and textPaths !!  
          var textContainersArray = storyArray[n].textContainers;  
          var lastTextContainer = textContainersArray[textContainersArray.length-1];  
           
          // A function call to the last text frame, if its story overflows:  
          doSomethingWithTextContainers(lastTextContainer);  
         };  
        
      }  
        
      function doSomethingWithTextContainers(/*textFrame or textPath*/textContainer)  
      {  
        if(textContainer.constructor.name == "TextFrame") // Could be text on path as well  
        {  
          // Here your code that is changing the size of your frame  
          // In my example code here it will only fill the frame with color Magenta:  
          textContainer.fillColor = "Magenta";  
          // If you want to move the text frame, consider to unlock it first, if it is locked.  
        }  
        if(textContainer.constructor.name == "TextPath")  
        {  
          // Here your code, if text on a path should overflow.  
          // Depending on the pageItem that holds the path, the parent should be the pageItem you are interested in.  
          // Usually a graphicLine or a polygon. Could also be an oval, a rectangle or even a textFrame.  
           textContainer.parent.fillColor = "Magenta";  
           textContainer.parent.strokeColor = "Magenta";  
        }  
       
      }  
        
    };  
    

    Thank you

    Alain bombaert

    As long as you do not create a new text container to correct excessive; the following script should work for you.

    //Scripted by ?Laubender?
    //modified by Skemicle
    if (parseFloat(app.version) < 6)
    main();
    else
    app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Splice Image Along Path");
    function main() {
        var doc = app.activeDocument;
        var stories = doc.stories;
        for(s=0;s		   
  • Need help on the position in order to bed

    Hello world

    I have an InDesign document with several layers. now I need to rearrange the position of layer command based on the name of the layer

    I tried but I can not able to correct the problem.

    Thanks in advance.

    -yajiv

    Before                                                                                After

    Screen Shot 2016-09-28 at 10.27.53 am.pngScreen Shot 2016-09-28 at 10.54.49 am.png

    Hello

    Here, you can try something like this:

    app.doScript("main()", ScriptLanguage.javascript, undefined, UndoModes.FAST_ENTIRE_SCRIPT, "Sort Layers!");
    
    function main()
    {
        var myDoc = app.activeDocument;
        for ( l = 0; l < myDoc.layers.length; l++)
        {
            var myLayerFirst = "Layer 1";
            var myLayersCounter = myDoc.layers.length - [l];
            var myLayerNext = "Layer " + myLayersCounter;
            myDoc.layers.item(myLayerNext).move(LocationOptions.AFTER, myDoc.layers.item(myLayerFirst));
        }
    }
    
    //          __ (^/) __
    

    (^/)

  • Find an object with an object style and increase its height! …

    Hi all

    I found each (anchored to the current text) 'invisible' block with a specific 'AA' object style and change its height SO its offset is > 180 (depending on the origin 0,0 page by default).

    This seems to be simple but, still, who doesn't!

    Thanks in advance!

    (^/)

    app.doScript("main()", ScriptLanguage.javascript, undefined, UndoModes.FAST_ENTIRE_SCRIPT, "xxx");
      
    function main()
    {  
      
    app.findObjectPreferences = null; 
    app.findObjectPreferences.appliedObjectStyles = "AA"; 
    myFound = app.activeDocument.findObject();
    
    
    for (i = 0; i < myFound.length; i++)  
         {  
            var myGB = myFound.geometricBounds;
            var myYOffset = myGB[2]; 
            var myHeight = myGB[2] - myGB[0]; 
            
            if (myYOffset[i] > 180) myHeight[i] += 90; 
         }  
    
    }
    

    Replace this:

    myFound.geometricBounds

    with this:

    .geometricBounds myFound [i]

    You must then change the geometricBounds and apply it to the object:

    myGB =...

    myFound [i] .geometricBounds = myGB

    Something in this direction.

    Peter

  • Edit an Indesign script for me?

    Hi all!

    I'm fairly new to Indesign scripting and I have a script here that I would have changed.

    This script puts a several page pdf in an Indesign file and add pages as needed. From now this script appears in a dialog box that asks you what document I want than the PDF to be placed in, and I would like to have this dialog box eleminated and have the script automatically place the pdf file in the document I have active. This script also asked which page to start to put the pdf file on and I would if it would simply just start automatically on the first page of the Indesign document active without even asking me. Someone would be willing to make these changes for the script below and zip code on this thread? Let me know if I did something clear.

    var myDocument = app.activeDocument;
    //Get the current page.
    main();
    function main(){
      //Display a standard Open File dialog box.
      var myPDFFile = File.openDialog("Choose a PDF File");
      if((myPDFFile != "")&&(myPDFFile != null)){
      var myDocument, myPage;
      if(app.documents.length != 0){
      var myTemp = myChooseDocument();
      myDocument = myTemp[0];
      myNewDocument = myTemp[1];
      }
      else{
      myDocument = app.documents.add();
      myNewDocument = false;
      }
      if(myNewDocument == false){
      myPage = myChoosePage(myDocument);
      }
      else{
      myPage = myDocument.pages.item(0);
      }
      myPlacePDF(myDocument, myPage, myPDFFile);
      }
    }
    function myChooseDocument(){
        var myDocumentNames = new Array;
        myDocumentNames.push("New Document");
        //Get the names of the documents
        for(var myDocumentCounter = 0;myDocumentCounter < app.documents.length; myDocumentCounter++){
            myDocumentNames.push(app.documents.item(myDocumentCounter).name);
        }
        var myChooseDocumentDialog = app.dialogs.add({name:"Choose a Document", canCancel:false});
        with(myChooseDocumentDialog.dialogColumns.add()){
            with(dialogRows.add()){
                with(dialogColumns.add()){
                    staticTexts.add({staticLabel:"Place PDF in:"});
                }
                with(dialogColumns.add()){
                    var myChooseDocumentDropdown = dropdowns.add({stringList:myDocumentNames, selectedIndex:0});
                }
            }
        }
      var myResult = myChooseDocumentDialog.show();
      if(myResult == true){
      if(myChooseDocumentDropdown.selectedIndex == 0){
      myDocument = app.documents.add();
      myNewDocument = true;
      }
      else{
      myDocument = app.documents.item(myChooseDocumentDropdown.selectedIndex-1);
      myNewDocument = false;
      }
      myChooseDocumentDialog.destroy();
      }
      else{
      myDocument = "";
      myNewDocument = "";
      myChooseDocumentDialog.destroy();
      }
        return [myDocument, myNewDocument];
    }
    function myChoosePage(myDocument){
        var myPageNames = new Array;
        //Get the names of the pages in the document
        for(var myCounter = 0; myCounter < myDocument.pages.length;myCounter++){
            myPageNames.push(myDocument.pages.item(myCounter).name);
        }
        var myChoosePageDialog = app.dialogs.add({name:"Choose a Page", canCancel:false});
        with(myChoosePageDialog.dialogColumns.add()){
            with(dialogRows.add()){
                with(dialogColumns.add()){
                    staticTexts.add({staticLabel:"Place PDF on:"});
                }
                with(dialogColumns.add()){
                    var myChoosePageDropdown = dropdowns.add({stringList:myPageNames, selectedIndex:0});
                }
            }
        }
        myChoosePageDialog.show();
        var myPage = myDocument.pages.item(myChoosePageDropdown.selectedIndex);
        myChoosePageDialog.destroy();
        return myPage;
    }
    function myPlacePDF(myDocument, myPage, myPDFFile){
      var myPDFPage;
      app.pdfPlacePreferences.pdfCrop = PDFCrop.cropMedia;
      var myCounter = 1;
      var myBreak = false;
      while(myBreak == false){
      if(myCounter > 1){
      myPage = myDocument.pages.add(LocationOptions.after, myPage);
      }
      app.pdfPlacePreferences.pageNumber = myCounter;
    
         myPDFPage = myPage.place(File(myPDFFile), [0,0])[0];
      if(myCounter == 1){
      var myFirstPage = myPDFPage.pdfAttributes.pageNumber;
      }
      else{
      if(myPDFPage.pdfAttributes.pageNumber == myFirstPage){
      myPage.remove();
      myBreak = true;
      }
      }
      myCounter = myCounter + 1;
      }
    }
    var myPDFFrame =  myPlacePDF.parent;
    

    Thank you very much in advance for your help! I greatly appreciate it!

    This is a rewrite for you. I also added some code to remove empty pages in the document.

    /*

    PlaceMulitpagePDF condensed by Skemicle Script

    */

    If (parseFloat (app.version)<>

    main();

    on the other

    app.doScript (principal, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Place Multipage PDF");

    main() {} function

    var myPDFFile is File.openDialog ("choose a PDF file");.

    If ((myPDFFile! = "") & (myPDFFile!) (= null)) {}

    var = app.activeDocument myDocument,

    myPage = myDocument.pages.item (0);

    var myPDFPage;

    app.pdfPlacePreferences.pdfCrop = PDFCrop.cropMedia;

    var myCounter = 1;

    var myBreak = false;

    while(myBreak == false) {}

    If (myCounter > 1) {}

    my page = myDocument.pages.add (LocationOptions.after, myPage);

    }

    app.pdfPlacePreferences.pageNumber = myCounter;

    myPDFPage = myPage.place (File (myPDFFile), [0,0]) [0];

    if(MyCounter == 1) {}

    New var features = myPDFPage.pdfAttributes.pageNumber;

    } else {}

    if(myPDFPage.pdfAttributes.PageNumber == myFirstPage) {}

    myPage.remove ();

    myBreak = true;

    }

    } myCounter = myCounter + 1;

    }

    } var pages = app.activeDocument.pages;

    for (c = 0; c<>

    If (pages.pageItems.length [c] == 0) {}

    pages [c]. Remove();

    }

    }

    }

  • countdowning page indesign numbering

    Hi guys!

    I have a book that is the design page number go backwards (289 next page will be 287, 288, 286 like that) but indesign does not support. Is there a script or plugin to solve this problem, thank you very much for any help!

    This script should solve the problem. The script has been implemented using the inch as the unit of measure... I didn't have other options.

    /*

    Written by Skemicle

    */

    If (parseFloat (app.version)<>

    main();

    on the other

    app.doScript (principal, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Add page backwards numbers");

    main() {} function

    var doc = app.activeDocument;

    Prefs var = doc.viewPreferences;

    UCO = prefs.horizontalMeasurementUnits;

    VMU = prefs.verticalMeasurementUnits;

    prefs.horizontalMeasurementUnits = MeasurementUnits.INCHES;

    prefs.verticalMeasurementUnits = MeasurementUnits.INCHES;

    ro var = doc.viewPreferences.rulerOrigin;

    doc.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;  ;

    doc.zeroPoint = [0,0];

    myPages var = doc.pages;

    var revPages = myPages.length;

    for (c = 0; c<>

    {with (MyPages [c].textFrames.Add ())}

    parentStory.justification = Justification.AWAY_FROM_BINDING_SIDE;

    geometricBounds = [10.5,.5, 10.75 8];

    content = String (revPages);

    } revPages = revPages - 1;

    } doc.viewPreferences.rulerOrigin = ro;

    doc.zeroPoint = [0,0];

    prefs.horizontalMeasurementUnits = uco;

    prefs.verticalMeasurementUnits = vmu;

    }

  • Imitating a sequence of keys

    Hello world

    I have a problem that I can't find information on I'm sorry to say that I don't have an example or even a beginning of a script to put it up here .

    I try to imitate a sequence of keys, I use a plug-in that is not supported by the script, but I've set up a keyboard shortcut in InDesign to perform an action.

    I use manually the combination of keys 'alt r', I wonder if there is the path of the script imitating this key combination, so I can run as part of a script?

    Any help welcome, Bren

    var altR = 'tell application "System Events" to keystroke "r" using {control down}';
    app.doScript(altR, ScriptLanguage.APPLESCRIPT_LANGUAGE, undefined, UndoModes.ENTIRE_SCRIPT, "MY CONTROL R");
    
  • How to quickly change cell STROKE weight

    Hello

    I am currently working on forms of subscription from the tabs. At present, the strokes are 1pt weight around each label and content to add cells. I'm looking for a quick way to 0.5 pt.

    I tried the script presented to this address: Script for find/replace, stroke at the tables , but when I run it returns an error 30614 (invalid object)

    Tell application "Adobe InDesign CC 2015" the value currWeight 1 newWeight set to 0.5 mytablelist set in each cell of each table for each block of text in the active document repeat with x 1 (counting the elements of mytablelist) the MyCell article x of mytablelist value if the race weight low set MyCell currWeight edge then low edge STROKE weight of MyCell on newWeight end if if the diagonal MyCell race weight is currWeight then the value race weight diagonal of MyCell to newWeight end if if the weight of the left edge of MyCell race is currWeight give to left-hand STROKE weight of MyCell newWeight end if if the weight of the right edge of MyCell race is currWeight give weight of race to the right edge of MyCell newWeight end if if the weight of the upper edge of the MyCell race is currWeight give weight of race to the top edge of MyCell newWeight end end if end tell

    I have the same answer (error 30614).

    I have no idea of what has past.

    Is there anyone kind enough to help with this problem?

    Kind regards

    Guillaume

    Finally try!

    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
    app.doScript
        (    
    
        main,
        ScriptLanguage.JAVASCRIPT,
        [],
        UndoModes.ENTIRE_SCRIPT,
        "Change Stroke Weight"    
    
        );    
    
    function main()
    {    
    
    var weight = Number(prompt("What is your starting weight?", 1,"Current Stroke Weight"));
    var newWeight = 0.5;    
    
    if(app.documents.length == 0){return};
    if(app.documents[0].stories.length == 0){return};
    if(app.documents[0].stories.everyItem().tables.length == 0){return};    
    
    var doc = app.documents[0];
    var allStories = doc.stories.everyItem();
    var allCells = allStories.tables.everyItem().cells.everyItem().getElements();    
    
    for(var n=0;n		   
  • Girls need help with a script to repeat the link to another folder in indesign

    I REALLY hope you smart people can help me.

    We had servers which means that all of our Indesign documents now have a broken link. To manually "re-edit the link to the file" causes Indesign down :-(. And it takes forever I am hoping to find a script that can connect all the links in the doc to a new file structure.

    The name of the link (name of file) and the file structure remains the same; Just point to another server. The structure contains subfolders so the best way would be that the script can see subfolders as well, but otherwise I would gladly use a script that points of 6 subfolders at a time.

    Problem - I KNOW NOT ALL SCRIPTS and I'm a graphic designer so I can't create scripts :-(. I have already had success Googling a script to unlink everything in the document, but I don't know how to run the script. DO NOT to create them.

    ANY help in this forum? I have 6 designers waiting for me to fix this.

    Is there a script where I could just change the path and then he could repeat?

    We have iMac OSX Yosemite 10.10.4

    PLEASE HELP... :-)

    / Dina

    Try this... it is created by Vamitul

    main() {} function

    var doc = app.activeDocument;

    myLinks var = doc.links.everyItem () .getElements ();

    var linkObj = {};

    Create the initial object

    / * {linkObject

    [path] {missingNr,

    arrayOfMissingLinks}

    } */

    for (var i = 0; i)< mylinks.length;="" i++)="">

    If (myLinks [i] .status == LinkStatus.LINK_MISSING) {}

    var myPath = File(myLinks[i].filePath).path.toString ();

    If (linkObj [myPath] == undefined) {}

    linkObj [myPath] = {}

    missingNr: 1.

    missingLinks: [myLinks [i]],.

    newPath: "

    }

    } else {}

    linkObj [myPath] .missingNr ++;

    linkObj [myPath].missingLinks.push (myLinks [i] .getElements () [0]);

    }

    }

    }

    $.writeln (linkObj.toSource ());

    var myDialog = new window ("dialog", "link Chaser:', undefined");

    Panel1 = myDialog.add var ('panel', undefined, "double-click to select the new path '");

    Panel1. Align = ["fill",""];

    myList var = panel1.add ("listBox", undefined, "", {})

    columnWidths: [160, 160, 130],

    numberOfColumns: 3,.

    showHeaders: true,

    columnTitles: ['old road', 'New Path', 'Nr. missing links']

    });

    myList.size = [450, 200];

    myList.align = ["fill",""];

    for {(var missingPath in linkObj)

    with (myList.add ("item", missingPath)) {}

    Subitems [0] .text is linkObj [missingPath] .newPath;.

    Paragraphs [1] .text is linkObj [missingPath] .missingNr;.

    }

    }

    myList.onDoubleClick = function() {}

    var myNewPath = (new folder (app.activeDocument.filePath) .selectDlg ("Select New Folder") |. toString() ' ");

    myList.selection.subItems [0] .text = myNewPath;

    linkObj [myList.selection.text] .newPath = myNewPath;

    }

    myDialog.add ('button', {undefined, "Ok",

    name: 'ok '.

    });

    myDialog.add ("button", undefined, "Cancel", {})

    name: "Cancel".

    });

    If (myDialog.show () == 1) {}

    for (var i in linkObj) {}

    If (linkObj [i] .newPath! = ") {}

    var fixedNr = 0;

    Var links = linkObj [i] .missingLinks

    for (var j = 0; j)< links.length;="" j++)="">

    var queue = newFile (linkObj [i] .newPath + "/" + links [j] .name);

    If {(newFile.exists)

    fixedNr ++;

    Links [j] .relink (NewFile);

    }

    }

    Alert ("in the folder: \n" + linkObj [i] .newPath + '\n' +)

    'Fixed' fixedNr ' links of ' + linkObj [i] .missingNr + '\n ' +.

    "Please check");

    }

    }

    };

    }

    app.doScript ('main()', undefined, undefined, UndoModes.entireScript, "Chaser link");

  • Formatting text (copy / paste)

    Hi friends,

    I need your help!

    I am writing a script that will find in particular for "IMP" paragraph style, as the first line of paragraph correspond to the width of the text frame and continues the second cutting line and paste it after the 3rd line (that style paragraph maximum 2 lines only). I have the screenshot for your friends to reference below. Please suggest all friends.

    Width of the frame of my text: pt 340,157

    Before running the script: the Normal text formatting.

    2.png

    After script execution: I need the text formatting.

    1.png

    Please advice friends. It is possible to script? (very urgent process).

    Thanks in advance

    This script will switch paragraph style of lines two and three of each textbox with the "TRUER" applied. See http://indesignsecrets.com/how-to-install-a-script-in-indesign-that-you-found-in-a-forum-o r-blog - post.php for more information on the installation and use of this script.

    /*

    Written by Skemicle

    */

    If (parseFloat (app.version)<>

    main();

    on the other

    app.doScript (principal, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Change lines 2 and 3");

    main() {} function

    var doc = app.activeDocument;

    txtBox var = doc.textFrames;

    for (a = 0;<>

    paragraphs var is txtbox [a].parentStory.paragraphs;.

    If (. appliedParagraphStyle.name paragraphs [0] == 'IMP') {}

    .silence paragraphs [1] = paragraphs [2] .silence + .silence paragraphs [1];

    .silence paragraphs [3] = "";

    }

    }

    }

  • Point to add to the script or Grep Style?

    Hello

    Is it possible to add a hightlight to a script?  Basically, what I want to do is highlight the text and the tricky part is that the text changes size depending on the size of the file, we are working on that.  I want to highlight automatically the "FOR PROFESSIONAL USE ONLY" the way that we do now is to underscore that in the menu options underscore: say my font size is 8, leading 9.6 (these will always change).

    Weight: = 9.6

    Shift: = - 8*.33

    Color = yellow

    It's the way we do now.  Can it be scripted or Grep style which will automatically do this for certain lines of text only?  And no matter the font size calculate what he needs to do if its 2pt, 10pt 100 PT etc... It will highlight the text specified correctly?

    I hope it's possible...

    Thank you

    The lower one is best.

    I remove a bug and also if not 'what' is provided to the point function culminating and there is no entry in find it which is the find panel of text and text is selected, then this text is highlighted.

    An idea in the script is that a shortcut can be applied to it and it will get its information from the Panel of text search.

    So for now to change the answer to this one

    // Highlight function by Trevor
    // http://creative-scripts.com
    // Custom Scripts for Adobe InDesign, Illustrator and a lot more
    // Beta Version 1
    // https://forums.adobe.com/message/8898663#8898663
    
    function highlight(what, color) {
        var range, s, doc;
        doc = app.properties.activeDocument;
        if (!doc) {
            return 'No Active Document';
        }
        s = app.selection && app.selection[0];
        range = (s && s.properties.underline !== undefined && s.characters.length) ? s : doc;
        app.doScript(f, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Highlight Text');
    
        function f() {
            var finds, find, l, leading, pointSize, currentChangeProps;
            color = color || app.activeDocument.colors.itemByName('Yellow');
            // Store current find change text settings
            currentFindTextWhat = app.findTextPreferences.findWhat;
            currentChangeProps = app.changeTextPreferences.properties;
            what = what || currentFindTextWhat;
            if (what !== '') {
                // if no what is provided then the current entry in the find text panel will be used
                app.findTextPreferences.findWhat = what;
                app.changeTextPreferences.changeTo = '';
                app.changeTextPreferences.underline = true;
                app.changeTextPreferences.underlineColor = color;
                finds = range.findText();
                range.changeText();
                l = finds.length;
                while (l--) {
                    find = finds[l];
                    leading = find.leading;
                    pointSize = find.pointSize;
                    leading = pointSize * find.autoLeading / 100;
                    find.underlineWeight = leading + 'pt'; // This is presuming that font and leading size is set to points!
                    find.underlineOffset = (pointSize - leading) * 1.5; // The 1.5 might need tweaking but seems to work well
                }
                app.findTextPreferences.findWhat = currentFindTextWhat;
                app.changeTextPreferences.properties = currentChangeProps;
            } else if (range !== app.activeDocument) {
                leading = range.leading;
                pointSize = range.pointSize;
                leading = pointSize * range.autoLeading / 100;
                range.underline = true;
                range.underlineColor = color;
                range.underlineWeight = leading + 'pt'; // This is presuming that font and leading size is set to points!
                range.underlineOffset = (pointSize - leading) * 1.5; // The 1.5 might need tweaking but seems to work well
            }
        }
    }
    
    /***************************************************************************************************************************************
    ** If text is selected then the "highlighting" is only applied within the selected text                                              **
    ** Otherwise the "highlighting" is applied within the whole document                                                                **
    ** One could change this to apply to what ever is selected in the Find text document if one wanted to                                **
    ** To highlight the word(s) in the find text panel just use highlight(); or highlight(undefined, app.activeDocument.swatches[5]);    **
    ** One can use highlight('Foo'); to highlight "foo" and ignore what's in the find text panel                                        **
    ** The formating / styles etc. for the find are taken from the find panel                                                            **
    ** If one provides a swatch as the second argument highlight(undefined, app.activeDocument.swatches[5]); that swatch will be used    **
    ** otherwise yellow will be used                                                                                                    **
    ** If one provides a swatch as the second argument highlight(undefined, app.activeDocument.swatches[5]); that swatch will be used    **
    ** If text is selected and what argument is given and the find what in the find panel is empty then the selected text is highlighted **
    **************************************************************************************************************************************/
    
    highlight();
    
  • Automatically convert soft line breaks in the text box to hard breaks

    I have the design of textbooks and convert to ePub recomposable, broke up. These ePub files get formatted then can be used interchangeably on the printed text. A book that I am currently in conversion is a literature book where there are lines of text with the overall line numbers so that teachers can quickly refer to a specific section of the text.

    All the line breaks in the ID file are defined just by the edge of the text box. So the text box change sizes, all line breaks would also change. Isn't a problem until you need to keep these online breeze in recomposable text and add up the numbers in.


    What I'm looking for is a way to insert automatically the line breaks in these LONG sections of text in the right places. Does anyone have any ideas on how to do that?

    Thank you!

    Select a text box and run this script. He puts a soft return at the end of each line that doesn't have a carriage return. For more information on the installation and use of this script see http://indesignsecrets.com/how-to-install-a-script-in-indesign-that-you-found-in-a-forum-o r-blog - post.php .

    Written by Skemicle

    If (parseFloat (app.version)<>

    main();

    on the other

    app.doScript (principal, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "add end of line returns");

    main() {} function

    lines of the var = app.selection [0].parentStory.lines;

    for (i = 0; i<>

    If (rows [i] .characters [-1] .silence! = "\r") {}

    lines [i] .characters [-1] .silence = "\n";

    }

    }

    }

Maybe you are looking for