Back

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

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 32 total)
  • Author
    Posts
  • Raphael Freeman
    Participant

    Enjoy!

    Raphael Freeman
    Participant

    Yes

    Raphael Freeman
    Participant

    My favourite script of all time!

    Raphael Freeman
    Participant
    in reply to: Indesign endnotes in long document #117149
    Raphael Freeman
    Participant

    No, it says “restart with each story”

    in reply to: Indesign endnotes in long document #117144
    Raphael Freeman
    Participant

    I’m not sure if I 100% understand what you are saying. If you want the endnotes to restart at each chapter, then each chapter needs to be it’s own InDesign story which requires breaking the story at chapter beginnings. Personally I hate this workflow and find working with endnotes very difficult as a result.

    in reply to: Indesign endnotes in long document #117141
    Raphael Freeman
    Participant

    You have to split the stories in the book (yes complete nightmare), one story per chapter!

    in reply to: Save pages as separeted INDD files #114184
    Raphael Freeman
    Participant
    Raphael Freeman
    Participant

    I spoke to the programmer and he wrote to me as follows:

    It can already be done with Extract Pages.
    (1) In InDesign, create 2 PDF export presets: one that exports as spreads, and the other as pages (“Export as spreads” is an option in the PDF export dialog box)
    (2) In Extract Pages, type in the page range.
    (3) select to export as “Group of pages” (so you get a single PDF rather than separate PDFs).
    (4) Make sure only to tick the “Create PDF files” checkbox.
    (5) Click on “Select PDF presets and Folders…” and choose the 2 presets you want to use.
    (6) Click on the Extract button and 2 PDFs will be created.

    Whether this is easier than manually exporting 2 separate PDFs I’m not sure.

    Raphael Freeman
    Participant

    Easier to print when the pdf is spreads. Also the UI on Acrobat to change single pages to spreads is a PITA.

    Raphael Freeman
    Participant

    You are right. You should write to the person who wrote the script (Tim Walden) and news@id-extras.com. Mention my name. He might be able to adapt the script to your needs. It’s actually a good idea and something that I might start doing for the same reason as you!

    Raphael Freeman
    Participant
    in reply to: Problems with arabic text #110962
    Raphael Freeman
    Participant

    can you send a screenshot showing the problem?

    in reply to: Auto Link image inline in running text #110950
    Raphael Freeman
    Participant

    // ASSUMES: UP TO 3 PARAGRAPHS OF INSTRUCTIONS
    // PARA STYLE NAME IDENTIFIES CONTENTS
    // name of folder has to be images
    // pstyles, picture, caption text, picture line
    //need to create an object styles called picture, caption frame, picture grouped
    // fix copy caption
    //use script ALT-R to resize

    var bSpreadOrigin=true; // sets ruler/origin to SPREAD — if false then PAGE origin

    var targetDPI = 300;
    var myRawFilename=””;
    var myFrameWidth=70; // DEFAULT FRAME WIDTH MILLIMETERS
    var myCaptionGap=6;// POINTS
    var myCaption=””;
    var hasCaption=false;
    var myGroup=[];
    var myFileNamePara=null;
    var myCaptionPara=null;

    var pageSizeAdjust=.9961;

    MainImportImage();
    //importImage();

    function MainImportImage(){
    dsr=app.activeWindow.viewDisplaySetting;
    app.activeWindow.viewDisplaySetting= ViewDisplaySettings.OPTIMIZED;

    app.doScript(importImage, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, “Import Picture”);
    //importImage();

    app.activeWindow.viewDisplaySetting=dsr;
    }

    function importImage(){
    if(bSpreadOrigin == true){
    app.activeDocument.viewPreferences.rulerOrigin = RulerOrigin.SPREAD_ORIGIN;
    app.activeDocument.zeroPoint = [ 0,0 ];
    }
    else{
    app.activeDocument.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;
    app.activeDocument.zeroPoint = [ 0,0 ];
    }
    myOldUnits=app.scriptPreferences.measurementUnit;

    app.scriptPreferences.measurementUnit = MeasurementUnits.MILLIMETERS;
    var pictureFolder=”images”; // SUBFOLDER OF DOCUMENT FOLDER

    myDoc=app.activeDocument;
    var myParas = [];
    myParas[1]=app.selection[0].paragraphs[0];
    myParas[2]=myParas[1].parentStory.paragraphs.nextItem(myParas[1]);
    // myParas[3]=myParas[1].parentStory.paragraphs.nextItem(myParas[2]);

    //
    // CHECK FOR STYLES – CREATE IF MISSING
    //
    if(app.activeDocument.paragraphStyles.item(“picture”).isValid == false){
    os=app.activeDocument.paragraphStyles.add();
    os.name=”picture”;
    //os.leading = “12pt”;
    //os.pointSize=”9pt”;
    //os.appliedFont=”Minion Pro”;
    }
    if(app.activeDocument.paragraphStyles.item(“caption text”).isValid == false){
    os=app.activeDocument.paragraphStyles.add();
    os.name=”caption text”;
    }
    if(app.activeDocument.paragraphStyles.item(“picture line”).isValid == false){
    os=app.activeDocument.paragraphStyles.add();
    os.name=”picture line”;
    os.leading = “0”;
    os.pointSize=”12pt”;
    os.appliedFont=”Arno Pro”;
    }

    if(app.activeDocument.objectStyles.item(“picture”).isValid == false){
    os=app.activeDocument.objectStyles.add();
    os.name=”picture”;
    }

    if(app.activeDocument.objectStyles.item(“caption frame”).isValid == false){
    os=app.activeDocument.objectStyles.add();
    os.name=”caption frame”;
    }
    if(app.activeDocument.objectStyles.item(“picture grouped”).isValid == false){
    os=app.activeDocument.objectStyles.add();
    os.name=”picture grouped”;
    }

    if(app.activeDocument.objectStyles.item(“RTIWpicture”).isValid == false){
    os=app.activeDocument.objectStyles.item(“picture”).duplicate();
    os.name=”RTIWpicture”;
    }
    if(app.activeDocument.objectStyles.item(“RTIWcaption frame”).isValid == false){
    os=app.activeDocument.objectStyles.item(“caption frame”).duplicate();
    os.name=”RTIWcaption frame”;
    }
    if(app.activeDocument.objectStyles.item(“RTIWpicture grouped”).isValid == false){
    os=app.activeDocument.objectStyles.item(“picture grouped”).duplicate();
    os.name=”RTIWpicture grouped”;
    }

    // END CHECK

    // Can we make the default stroke to be nothing for the ostyles: picture,
    // caption frame and picture group?
    // os=app.activeDocument.objectStyles.item(“RTIWpicture”);
    // os.enableStroke=true;
    // os=app.activeDocument.objectStyles.item(“RTIWcaption frame”);
    // os.enableStroke=false;
    // os=app.activeDocument.objectStyles.item(“RTIWpicture grouped”);
    // os.enableStroke=false;

    // yes

    p=myParas[1];
    psName=p.appliedParagraphStyle.name;
    if (psName==”picture”) {myRawFilename=p.contents;}
    p=myParas[2];
    psName=p.appliedParagraphStyle.name;
    if (psName==”caption text”) { myCaption=p;hasCaption=true;}
    // if (psName==”width”) myFrameWidth=p.contents;

    //alert(myRawFilename+”====”+hasCaption+”===”+myCaption.contents);return;

    myPictureAnchor=myParas[1].insertionPoints[0];
    currentPage=app.activeWindow.activePage;

    var myImageFrame = currentPage.textFrames.add();
    myImageFrame.appliedObjectStyle=app.activeDocument.objectStyles.item(“RTIWpicture”);

    var myBounds = myImageFrame.geometricBounds;
    myArray = [0, 150, 32, 150+myFrameWidth];
    myImageFrame.geometricBounds = myArray;

    // alert(“resized”);

    imgPath=myDoc.filePath+”/”+pictureFolder+”/”+myRawFilename;
    picPath=fixPath(imgPath);

    f=new File(picPath);
    try{
    myImageFrame.place (f);
    }
    catch(e){
    alert(“problem with image “+f.name+”. Does it exist?”);

    return;
    }

    myImageFrame.fit(FitOptions.PROPORTIONALLY);
    myImageFrame.fit(FitOptions.FRAME_TO_CONTENT);
    resizeToDPI(myImageFrame);

    myGroup.push(myImageFrame);

    app.scriptPreferences.measurementUnit = MeasurementUnits.POINTS;

    if(hasCaption) {
    var myCaptionFrame=currentPage.textFrames.add();
    myImageBounds = myImageFrame.geometricBounds;
    myCapArray = [myImageBounds[2]+myCaptionGap, myImageBounds[1], myImageBounds[2]+myCaptionGap+100, myImageBounds[3]];
    myCaptionFrame.geometricBounds = myCapArray;
    myCaption.duplicate(LocationOptions.AFTER,myCaptionFrame.parentStory.insertionPoints[-1]);
    //myCaptionFrame.contents=myCaption;
    myCaptionFrame.appliedObjectStyle=app.activeDocument.objectStyles.item(“RTIWcaption frame”);
    myCaptionFrame.paragraphs[0].appliedParagraphStyle=app.activeDocument.paragraphStyles.item(“caption text”);
    capBot=myCaptionFrame.lines[-1].baseline+3;
    myCapArray = [myImageBounds[2]+myCaptionGap, myImageBounds[1], capBot, myImageBounds[3]];
    myCaptionFrame.geometricBounds = myCapArray;

    s=myCaptionFrame.lines[-1];

    app.findGrepPreferences = NothingEnum.NOTHING;
    app.changeGrepPreferences = NothingEnum.NOTHING;
    app.findGrepPreferences.findWhat = “r”;
    app.changeGrepPreferences.changeTo= “”;
    x = s.changeGrep();

    // fit it
    myCaptionFrame.fit(FitOptions.FRAME_TO_CONTENT);

    // GROUP THEM…
    myGroup.push(myCaptionFrame);
    g=currentPage.groups.add(myGroup);
    g.appliedObjectStyle=app.activeDocument.objectStyles.item(“RTIWpicture grouped”);
    }
    else{
    var myCaptionFrame=currentPage.textFrames.add();
    myImageBounds = myImageFrame.geometricBounds;

    myCapArray = [myImageBounds[2]-3, myImageBounds[1], myImageBounds[2], myImageBounds[3]];
    myCaptionFrame.geometricBounds = myCapArray;
    myCaptionFrame.appliedObjectStyle=app.activeDocument.objectStyles.item(“RTIWcaption frame”);
    myGroup.push(myCaptionFrame);

    g=currentPage.groups.add(myGroup);
    g.appliedObjectStyle=app.activeDocument.objectStyles.item(“RTIWpicture grouped”);
    }

    // MARCH 6 2017 MOVED FROM ABOVE TO HERE
    p=myParas[2];
    psName=p.appliedParagraphStyle.name;
    if (psName==”caption text”) { myParas[2].remove();}
    p=myParas[1];
    psName=p.appliedParagraphStyle.name;
    if (psName==”picture”) {
    l=p.lines[0].length;
    for(i=0;i<l-1;i++){p.characters[i].contents=” “;}
    }

    myParas[1].appliedParagraphStyle=app.activeDocument.paragraphStyles.item(“picture line”);

    // RECHECK G THAT IT FITS PAGE VERTICALLY — RESIZE v2 IF NOT — March 22 2018
    checkSize(g);

    // ANCHOR GROUP INTO TEXT
    app.select(g);

    try{
    app.copy();
    app.select(myPictureAnchor);
    app.paste();
    app.select(g);
    app.cut()
    }
    catch(e){
    alert(“Error ” + e);
    }
    //g.anchoredObjectSettings.insertAnchoredObject(myPictureAnchor);

    // DELETE CAP LINE IF EXISTS

    // delete spaces
    app.findGrepPreferences = NothingEnum.NOTHING;
    app.changeGrepPreferences = NothingEnum.NOTHING;
    app.findGrepPreferences.findWhat=” +(?=\r)”;

    app.changeGrepPreferences.changeTo = “”;
    myParas[1].changeGrep();

    app.scriptPreferences.measurementUnit=myOldUnits;

    }

    function fixPath(str){
    //Z:ooks\freemanest Folder\Pictures
    var pos = str.indexOf(“/”);
    if(pos==0){
    ns=str.substr(1);
    d=ns.substr(0,1);
    p=ns.substr(2);
    newpath=d+”:”+p;
    np=newpath.replace(/%20/g,” “);
    newpath=np.replace(“\r”,””);

    return newpath;
    }
    str1=str.replace(/%20/g,” “);
    str=str1.replace(“\r”,””);
    return str;
    }

    function resizeToDPI(myImageF){

    var myPage = app.activeWindow.activePage;
    var myMargins = myPage.marginPreferences;

    gb= [myPage.bounds[0]+myMargins.top,myPage.bounds[1]+myMargins.left,myPage.bounds[2]-myMargins.bottom,myPage.bounds[3]-myMargins.right];

    conTopPage = gb[0];
    conBottomPage = gb[2];
    conLeftPage = gb[1];
    conRightPage = gb[3];
    conPageWidth=conRightPage-conLeftPage;
    conPageHeight=conBottomPage-conTopPage;

    //~ gpH=myGroup.geometricBounds[2]-myGroup.geometricBounds[0];
    //~ gpW=myGroup.geometricBounds[3]-myGroup.geometricBounds[1];
    gpH=myImageF.geometricBounds[2]-myImageF.geometricBounds[0];
    gpW=myImageF.geometricBounds[3]-myImageF.geometricBounds[1];

    //alert(GetLiveBounds (app.activeWindow.activePage));

    gpHWRatio=gpH/gpW;

    growValue=conPageWidth/gpW;

    if((gpH*growValue)>conPageHeight){
    growValue=conPageHeight/gpH;
    }

    myWidth=gpW*growValue;

    if(myImageF!=null)
    {
    gb=myImageF.geometricBounds;
    oldWidth=gb[3]-gb[1];

    ratioW=myWidth/oldWidth;
    oldHeight=gb[2]-gb[0];
    newHeight=oldHeight*ratioW;
    gb[3]=gb[1]+myWidth;
    gb[2]=gb[0]+newHeight;
    myImageF.geometricBounds=gb;

    myImageF.fit(FitOptions.PROPORTIONALLY);
    myImageF.fit(FitOptions.CONTENT_TO_FRAME);

    //myImageF.fit(FitOptions.FRAME_TO_CONTENT);

    // CHECK EFFECTIVE DPI
    myImage=myImageF.allGraphics[0];
    try{
    if(myImage.effectivePpi[0]<targetDPI){
    newScale=100*myImage.actualPpi[0]/targetDPI;
    myImage.horizontalScale=myImage.verticalScale=newScale;
    myImageF.fit(FitOptions.FRAME_TO_CONTENT);
    }
    }
    catch(e){
    myImageF.fit(FitOptions.PROPORTIONALLY);
    myImageF.fit(FitOptions.FRAME_TO_CONTENT);
    www=myImageF.geometricBounds[3]-myImageF.geometricBounds[1];

    gb=myImageF.geometricBounds;
    gb[3]=gb[1]+conPageWidth;
    gb[2]=gb[0]+((gb[2]-gb[0])*(conPageWidth/www));
    myImageF.geometricBounds=gb;
    newScale=100*conPageWidth/www;
    myImage.horizontalScale=myImage.verticalScale=newScale;
    myImageF.fit(FitOptions.PROPORTIONALLY);
    myImageF.fit(FitOptions.CONTENT_TO_FRAME);
    }
    }

    }

    function checkSize(picGroup){

    var myPage = app.activeWindow.activePage;
    var myMargins = myPage.marginPreferences;
    myImageF=picGroup.rectangles[0];
    myCapF=picGroup.textFrames[0];
    myImage=myImageF.allGraphics[0];
    groupHeight=picGroup.geometricBounds[2]-picGroup.geometricBounds[0];
    //alert(picGroup.geometricBounds[3]-picGroup.geometricBounds[1]);return;

    gb= [myPage.bounds[0]+myMargins.top,myPage.bounds[1]+myMargins.left,myPage.bounds[2]-myMargins.bottom,myPage.bounds[3]-myMargins.right];

    conTopPage = gb[0];
    conBottomPage = gb[2];
    conLeftPage = gb[1];
    conRightPage = gb[3];
    conPageWidth=conRightPage-conLeftPage;
    conPageHeight=conBottomPage-conTopPage;
    conPageHeight*=pageSizeAdjust;//ADJUST

    if(groupHeight<conPageHeight){return;}

    newScaleValue=(conPageHeight/groupHeight);

    myImage.horizontalScale*=newScaleValue;
    myImage.verticalScale*=newScaleValue;
    myImageF.fit(FitOptions.FRAME_TO_CONTENT);
    if(hasCaption){
    cgb=myCapF.geometricBounds;
    cgb[1]=myImageF.geometricBounds[1];
    cgb[3]=myImageF.geometricBounds[3];

    h=cgb[2]-cgb[0];
    cgb[0]=myImageF.geometricBounds[2]+myCaptionGap;
    cgb[2]=cgb[0]+h+20;
    myCapF.geometricBounds=cgb;
    cgb[2]=myCapF.lines[-1].baseline+1;
    myCapF.geometricBounds=cgb;
    }
    else{
    myImageBounds=myImageF.geometricBounds;
    cgb=myCapF.geometricBounds;
    myCapArray = [myImageBounds[2]-3, myImageBounds[1], myImageBounds[2], myImageBounds[3]];
    myCapF.geometricBounds = myCapArray;
    }
    groupHeight=picGroup.geometricBounds[2]-picGroup.geometricBounds[0];
    if(groupHeight<conPageHeight){return;}

    groupHeight=picGroup.geometricBounds[2]-picGroup.geometricBounds[0];
    newScaleValue=(conPageHeight/groupHeight);

    myImage.horizontalScale*=newScaleValue;
    myImage.verticalScale*=newScaleValue;
    myImageF.fit(FitOptions.FRAME_TO_CONTENT);
    if(hasCaption){
    cgb=myCapF.geometricBounds;
    cgb[1]=myImageF.geometricBounds[1];
    cgb[3]=myImageF.geometricBounds[3];

    h=cgb[2]-cgb[0];
    cgb[0]=myImageF.geometricBounds[2]+myCaptionGap;
    cgb[2]=cgb[0]+h+20;
    myCapF.geometricBounds=cgb;
    cgb[2]=myCapF.lines[-1].baseline+1;
    myCapF.geometricBounds=cgb;
    }
    else{
    myImageBounds=myImageF.geometricBounds;
    cgb=myCapF.geometricBounds;
    myCapArray = [myImageBounds[2]-3, myImageBounds[1], myImageBounds[2], myImageBounds[3]];
    myCapF.geometricBounds = myCapArray;
    }
    groupHeight=picGroup.geometricBounds[2]-picGroup.geometricBounds[0];
    if(groupHeight<conPageHeight){alert(“problem VFitting”);return;}

    }

    function GetLiveBounds (page) {//gets the bounds within page margins
    app.scriptPreferences.measurementUnit = MeasurementUnits.MILLIMETERS;
    var bounds = page.bounds;
    // alert(bounds);
    return [
    page.marginPreferences.top,
    page.side == PageSideOptions.leftHand ? bounds[1] + page.marginPreferences.right : bounds[1] + page.marginPreferences.left,
    bounds[2] – page.marginPreferences.bottom,
    page.side == PageSideOptions.leftHand ? bounds[3] – page.marginPreferences.left : bounds[3] – page.marginPreferences.right
    ]
    }//end function getLiveBounds

    in reply to: Adding space between punctuation and superscript with GREP #110735
    Raphael Freeman
    Participant

    so I checked my older kerning script which is no where near as efficient as Peter’s and unfortunately that won’t solve your problem so your “cheat” was the best solution.

Viewing 15 posts - 1 through 15 (of 32 total)