Back

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

Forum Replies Created

Viewing 15 posts - 481 through 495 (of 1,338 total)
  • Author
    Posts
  • in reply to: Auto import hundreds of images #60882

    Huh — only now I notice the editor is smarter than I am!

    This is the HTML code you need to insert:

    {pre}{code}

    .. your script comes here

    {/code}{/pre}

    And of course you need to replace the curly braces with <..>

    It seems the editor not only doesn't like backslashes (as you have noticed elsewhere :) ) but also agressively interprets anything that looks like HTML.

    in reply to: Auto import hundreds of images #60875

    Trial and error :)

    The forum editor is picky when accepting formatting code, so I switch to HTML view and insert this manually:

    … your code comes here
    remember to escape &, < and >
    (as well as the usual \ to get )

    If I remember correctly you have to be very careful when post-editing.

    in reply to: Auto import hundreds of images #60870

    (Looks around) We're in the Scripting forum, right?

    someFolder = Folder.selectDialog (“Choose a Folder”);
    if (someFolder != null)
    {
    filenameList = [];
    fileList = someFolder.getFiles( function(x) { return x instanceof File && !x.hidden; } );

    if (fileList.length > 0)
    {
    writeFile = File.saveDialog( 'Save File As:' )
    if (writeFile != null)
    {
    if (writeFile.open(“w”))
    {
    for (i=0; i<fileList.length; i++)
    writeFile.write (fileList[i].fsName+”r”);
    writeFile.close();
    } else
    alert (“unable to create file “+writeFile.fsName);
    }

    } else
    alert (“No files found in “+someFolder.fsName);

    }

    in reply to: Change Style attributes #60826

    Designate one of your styles as the Master and base all of your other styles on that one. Then you only have to change the text color in this one.

    Alternative #1: if all of your styles already have some custom swatch applied, delete it in the Swatches panel and replace with the new one.

    Alternative #2: well I guess it can be scripted as well.

    in reply to: Grep simple query #60825

    That oughtn'tn'tt've happened. Which of the two GREPs are you using? (They don't mix!)

    in reply to: Grep simple query #60798

    Only for today I'll offer you not one but two ways.

    Search for

    (d.)[a single space]+

    Replace with

    $1t

    The parentheses mark “Found group #1”, and you can insert this back again in the Replace expression with “$1”. This feature is particularly useful when you need to swap two items around (in Replace you can use something like “$2 $1”) or want to repeat something (simply write “$1 $1 $1 $1” to get five copies of whatever you found).

    There is a more advanced way, though: you can search for one or more spaces and then use a Positive Lookbehind to ensure these are preceded by a digit plus a period. The advantage is the expression doesn't “touch” the digits, only (I believe it is an advantage, but for reasons more spiritual rather than practical. It may also run a bit faster.).

    Search for

    (?<=d.)[a single space]+

    Replace with

    t

    in reply to: Simple relink script help! #60779

    Kasyan, it's okay to use forward slashes in an InDesign script – even under Windows.

    in reply to: The Pub doesn't mean EPUB #60769

    We got our booze / bragging / pool table corner back to ourselves!

    But honestly David, excellent idea.

    So… no-one noticed I got rid of the long hair & 'stache? (As he inquired while lifting a cold one to his lips.)

    … Here is a script that does just that. Warning: it may change more than you want, and it's hard to see what it changed! Uncomment the fill-with-color lines if you need to know where the changes occurred (and run on a copy).

    indentStyle = “Body-Indent”;
    noIndentStyle = “Body-No Indent”;

    if (app.documents.length > 0 && app.selection.length == 1 && app.selection[0].hasOwnProperty(“baseline”))
    {
    story = app.selection[0].parentStory.paragraphs;
    lastStyle = null;
    for (i=0; i<story.length; i++)
    {
    // Do we need to change?
    if (story[i].appliedParagraphStyle.name == indentStyle ||
    story[i].appliedParagraphStyle.name == noIndentStyle)
    {
    // Do we want an indent?
    if ((lastStyle == indentStyle || lastStyle == noIndentStyle))
    {
    lastStyle = indentStyle;
    if (story[i].appliedParagraphStyle.name == noIndentStyle)
    {
    story[i].appliedParagraphStyle = indentStyle;
    // story[i].fillColor = “Red”;
    }
    } else if (!(lastStyle == indentStyle || lastStyle == noIndentStyle))
    {
    lastStyle = noIndentStyle;
    if (story[i].appliedParagraphStyle.name == indentStyle)
    {
    lastStyle = story[i].appliedParagraphStyle = noIndentStyle;
    // story[i].fillColor = “Green”;
    }
    }
    } else
    {
    lastStyle = null;
    }
    }
    }

    I presume you mean you might move “1st paragraph after a heading” and “any next paragraphs” around, and there should always be a “don't indent” style after any sort of heading (*) and “indent” after any “don't indent” OR “indent” style.

    I bet Framemaker does this out-of-the-box :) but in InDesign you'd have to run a script after every major edit.

    (*) Typically, one would never indent a plain text paragraph after a heading or some white space, such as at the end of a list.

    Ah, how ingenious mr. Bunt.

    Actually, I may have used your method before I knew how to script and thus had to use my brains!

    in reply to: Place image and change position? #60759

    Use move to move an image.

    .. whacked this out in 30 seconds:

    app.findTextPreferences = null;
    app.findTextPreferences.appliedParagraphStyle = “H2”;
    var myResults = app.activeDocument.findText();
    for (i=0; i<myResults.length; i++)
    myResults[i].parentStory.paragraphs.nextItem(myResults[i].paragraphs[0]).appliedParagraphStyle = “No Indent Body”;

    Can't be done, it needs a script.

    in reply to: Animation conumdrum: Is an Auto slideshow possible in IDCS5? #60738

    I don't think InDesign would be the program to design advanced SWF animations in. The Export-to-SWF option is rather intended for re-purposing a printed book, and not really meant as a full replacement for a Flash editor.

Viewing 15 posts - 481 through 495 (of 1,338 total)