Back

If your email is not recognized and you believe it should be, please contact us.

Forum Replies Created

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • in reply to: Is it possible to find the end of line with grep? #64498
    Eugenyus
    Member

    Another solution is to place Hair Space between the space and the anchor marker:

    Find What: s(?=~a)

    Change To: $0~|

    in reply to: Unlock all layers in the book #64375
    Eugenyus
    Member

    Maybe it's because you're using a mac?..

    in reply to: Unlock all layers in the book #64365
    Eugenyus
    Member

    var d = app.activeBook.bookContents.everyItem().fullName;
    for (i=0;i<d.length;i++){
    app.open(d[i]);
    with (app.activeDocument){
    layers.everyItem().locked = false;
    save();
    close();
    }
    }

    in reply to: Using GREP to make conditional line breaks #64333
    Eugenyus
    Member

    Yes, of course)):

    . — any character;

    + — repeat one or more times;

    (?=) — positive lookahead;

    $ — location at the end of paragraph.

    in reply to: GREP removing parentheses #64330
    Eugenyus
    Member

    Find What: ((.+?))

    Change To: $1

    in reply to: Using GREP to make conditional line breaks #64327
    Eugenyus
    Member

    Find what: dba.+(?=$)

    Change To: empty; Change Format: No Break.

    in reply to: change all Based On to [No Paragraph Style] #64322
    Eugenyus
    Member

    Please, change the en-dash (–) to (-) two times — in 12 and 17 lines:

    len = len – 1;

    (it is somehow replaced when I made copy-paste from ESTK to the post).

    in reply to: change all Based On to [No Paragraph Style] #64318
    Eugenyus
    Member

    #targetengine “basedon”
    var aps = app.activeDocument.allParagraphStyles;
    var acs = app.activeDocument.allCharacterStyles;
    var len = aps.length+acs.length;
    var w = new Window(“palette”,”based on”);
    w.orientation = “row”;
    w.add(“statictext”,undefined,”styles left: “);
    var num = w.add(“statictext”,undefined,String(len));
    w.show();
    for (i=1;i<aps.length;i++){
    aps[i].basedOn = app.activeDocument.paragraphStyles[0];
    len = len – 1;
    num.text = String(len);
    }
    for (i=1;i<acs.length;i++){
    acs[i].basedOn = app.activeDocument.characterStyles[0];
    len = len – 1;
    num.text = String(len);
    }
    w.close();
    alert(“Finished”);

    in reply to: Toggle on off Layout Adjustment #64250
    Eugenyus
    Member

    The same, but shorter:

    with (app.activeDocument.layoutAdjustmentPreferences) enableLayoutAdjustment = !enableLayoutAdjustment;

    in reply to: adding empty lines (paragraphs) #64241
    Eugenyus
    Member

    Run the script. Select a text, that shows you the number of lines you need to add, press the button “Remember the Number of Lines” (after that you may press “Cancel” to cancel your choice). Than select an insertion point where you need to add empty paragraphs and press the button “Insert Empty Lines” (sorry for my english :) ).

    #targetengine “addemptylines”
    //(c) Eugenyus,2013,v1.0. Eugenyus@mail.ru
    var myEventHandler = function(ev){
    try{numsellines.text = String(doc.selection[0].lines.length);}catch(e){numsellines.text = “0″;}
    }

    var doc = app.activeDocument;
    try{var numoflines = String(doc.selection[0].lines.length);}catch(e){var numoflines = “0″;}
    var w = new Window(“palette”);
    w.orientation = “row”;
    w.add(“statictext{text:”number of lines selected: “}”);
    var numsellines = w.add(“statictext{text:”+numoflines+”,characters:4}”);
    var remBut = w.add(“button”,undefined,”Remember the Number of Lines”);
    var remembed = false;
    remBut.onClick = function(){
    if (!remembed){
    doc.removeEventListener('afterSelectionChanged', myEventHandler);
    remBut.text = “Cancel”;
    }
    else{
    doc.addEventListener('afterSelectionChanged', myEventHandler);
    remBut.text = “Remember the Number of Lines”;
    }
    remembed = !remembed;
    app.activate();
    }
    var addBut = w.add(“button”,undefined,”Insert Empty Lines”);
    addBut.onClick = function(){
    if ((remembed)&&(doc.selection[0].constructor.name == “InsertionPoint”)){
    for(i=0;i<Number(numsellines.text);i++){
    doc.selection[0].contents+=”r”;
    }
    remBut.text = “Remember the Number of Lines”;
    remembed = !remembed;
    doc.addEventListener('afterSelectionChanged', myEventHandler);
    }
    app.activate();
    }
    doc.addEventListener('afterSelectionChanged', myEventHandler);

    w.onClose = function(){
    doc.removeEventListener('afterSelectionChanged', myEventHandler);
    }

    w.show();

    Eugenyus
    Member

    var doc = app.activeDocument;
    var piLabels = doc.pageItems.everyItem().label;
    piLabels.sort();
    var frstLabel = lastLabel = 0;
    do{
    while (piLabels[frstLabel] == piLabels[lastLabel+1]){lastLabel++;}
    if (lastLabel != frstLabel) {
    piLabels.splice(frstLabel, lastLabel-frstLabel+1);
    lastLabel = frstLabel;
    }
    else{
    frstLabel++;
    }
    }while(frstLabel!=piLabels.length-1);
    alert(piLabels.join(“n”)); //Lists the labels without having to iterate…

    in reply to: Export pages to jpg with custom filenames #64231
    Eugenyus
    Member

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

    function myPS(){
    try{return myDoc.selection[0].appliedParagraphStyle;}
    catch(e){alert(“Place cursor to text with paragraph style for filenames”); exit();}
    }

    function MakeJPEGfile(){
    app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.high;
    app.jpegExportPreferences.exportResolution = 72;
    app.jpegExportPreferences.jpegExportRange = ExportRangeOrAllPages.exportRange;

    app.findGrepPreferences = null;
    app.findGrepPreferences.appliedParagraphStyle = myPS();
    var f = myDoc.findGrep();

    for (var myCounter = 0; myCounter < f.length; myCounter++){
    try{
    var curPage = f[myCounter].parentTextFrames[0].parentPage;
    if (curPage.appliedSection.name != “”) {curPage.appliedSection.name = “”;}
    var objName = f[myCounter].contents.replace(/ /g,”_”).toLowerCase();

    app.jpegExportPreferences.pageString = curPage.name;
    var myFilePath = myDoc.filePath + “/” + objName + “.jpg”; //export to a folder of the current document
    var myFile = new File(myFilePath);
    myDoc.exportFile(ExportFormat.jpg, myFile, false);
    }
    catch(e){}//pasteboard?
    }
    }

Viewing 12 posts - 1 through 12 (of 12 total)