Back

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

Forum Replies Created

Viewing 15 posts - 151 through 165 (of 340 total)
  • Author
    Posts
  • in reply to: Why doesn't this line of code work #100348
    Peter Kahrel
    Participant

    clearObjectStyleOverrides removes object style overrides, not paragraph overrides. Maybe try

    app.activeDocument.textFrames[0].paragraphs.everyItem().clearOverrides(OverrideType.ALL);

    in reply to: Javascript target footer row #100332
    Peter Kahrel
    Participant

    Hi Kai,

    > you cannot target footer rows directly?!

    Well, in a way you can:

    The nth footer row in a table:

    myTable.rows [myTable.headerRowCount + myTable.bodyRowCount + n-1]

    Peter

    in reply to: Why doesn't this line of code work #100331
    Peter Kahrel
    Participant

    Check the object model in some viewer. clearOverrides() is not a property or function of text frames, only of text objects (words, characters, lines, etc).

    in reply to: Spell out state abbreviations #99965
    Peter Kahrel
    Participant

    Try changing this line:

    app.findGrepPreferences.findWhat = “”+abbrevs[a][1]+””;

    to

    app.findGrepPreferences.findWhat = “”+abbrevs[a][1]+”(?!,)”;

    which translates as ‘Find tw-letter abbreviations not followed by a comma’. It may still find things you’re not after, so click ‘Find next’ a few times to see what you get.

    P.

    in reply to: Automatically update prices in a indesign document #99795
    Peter Kahrel
    Participant

    Steve,

    I think that this script allows you to do what you want: https://www.kahrel.plus.com/indesign/price_adjuster.html

    The script is a combination of Steve Wareham’s number adjuster and Olav Kvern’s price updating scripts with some embellishments. It handles more thousand seperator symbols than just comma and dot,so it may work for you.

    Peter

    in reply to: Simple script to open and save file #99234
    Peter Kahrel
    Participant

    > I would guess you wouldn’t replace the template with an indesign file as they have differing extensions.

    Correct.

    > So wouldn’t you end up with a template file and a new indesign file by running this script?

    Correct.

    in reply to: Help creating a loop #99230
    Peter Kahrel
    Participant

    Maybe look around here: https://kasyan.ho.com.ua/scripts_by_categories.html
    This is not my web site, it’s Kasyan Servetsky’s. If you can’t find what you’re looking for, write to him, his contact address is on his web site.

    in reply to: Apply Master page based on page number #99155
    Peter Kahrel
    Participant

    This is a good starting point:

    https://www.safaribooksonline.com/library/view/scripting-indesign-cs34/9780596803599/

    It has CS3/4 in its title, but scripting has hardly changed in recent since then.

    Peter

    in reply to: Apply Master page based on page number #99151
    Peter Kahrel
    Participant

    The script to do this on a single document is this simple one-liner:

    app.documents[0].pages[0].appliedMaster = app.documents[0].masterSpreads.item ('A-Master');

    Doing that on 300+ documents is a little trickier. You have two options:

    https://kasyan.ho.com.ua/batch_process_scripts/batch_process_scripts.html
    https://www.kahrel.plus.com/indesign/batch_convert.html

    Peter

    in reply to: Help creating a loop #99078
    Peter Kahrel
    Participant

    Take a look at this script:

    https://kasyan.ho.com.ua/place_images.html

    It shows how to place images using a loop and how to get files from folders and subfolders. It’s unlikely to do exactly what you you’re after, but there’s enough there to give you ideas and to keep you busy for a while :)

    in reply to: Help creating a loop #99071
    Peter Kahrel
    Participant

    If you’re going to place images using a loop, you have to know beforehand where those images should be placed. For instance, image 1 on p. 10, image 2 on p. 11, image 3 on p. 12, etc. Or images go to rectangles named after the images on the Layers panel. E.g. img01.jpg is placed in myDoc.rectangles.item(‘img01’), img02.jpg in myDoc.rectangles.item(‘img02’), etc. The placement that you gave in your first post:

    myDoc.pages[11].rectangles[0].place(myImg01, false);
    myDoc.pages[12].rectangles[0].place(myImg02, false);
    myDoc.pages[12].rectangles[1].place(myImg03, false);
    myDoc.pages[13].rectangles[0].place(myImg04, false);

    is (probably) not predicatable and/or consistent: how do you know which images are placed on which rectangle on which page?

    P.

    in reply to: Help creating a loop #99013
    Peter Kahrel
    Participant

    If you have four images I wouldn’t bother with a loop.

    > I intend to expand the script later, so my next question would probably be how do I make the loop go through multiple folders

    That’s a long and non-trivial story. . .

    in reply to: Help creating a loop #98950
    Peter Kahrel
    Participant

    How many images are there to place? And how do you know that 2 and 3 are on one page, and 1 and 4 not?

    in reply to: Simple script to open and save file #98836
    Peter Kahrel
    Participant

    Hi Mike — Actually, there’s no need to create new file objects separately. You can do it as follows:

    var template = app.open (File ('~/Desktop/test.indt'));
    // Do stuff
    template.save (File('~/Desktop/test01.indd'));
    template.close();

    Peter

    in reply to: Order of Text Frames #97129
    Peter Kahrel
    Participant

    > In what sequence js reaches each text frame?

    In what way ‘next’? If you mean the next threaded frame, then nextTextFrame returns a frame’s next frame:

    frame = myTextFrame.nextTextFrame;

    With unthreaded frames, as Lindsey mentions, their indexes reflect the order of creation.

Viewing 15 posts - 151 through 165 (of 340 total)