Forum Replies Created

Viewing 15 posts - 1,126 through 1,140 (of 1,335 total)
  • Author
    Posts
  • in reply to: GREP Style with Search/Replace? #55300

    .. I looked into if GREP had it's own Search/Replace built-in ..

    Say whuh? You would like to do a Search-and-replace inside a GREP expression or something like that?

    You are correct about the GREP styles, though — all they can do is apply formatting. I don't think it would be a wise move to “automagically” have it replace text … see also the discussion in one of the GREP Style threads on why it's a bad, bad idea to use GREP to “hide” double spaces and typos.

    You can try this: apply a style with lots of tracking (+100 or more) to

    .~_

    in reply to: GREP Style with Search/Replace? #52315

    Calvin:

    find: a glyph followed by an em-dash followed by a glyph

    apply: character style to the em-dash and the preceding glyph (since the tracking only applies to the space after a glyph when highlighting a single glyph)

    Ehm… That's what this GREP does

    .~_

    I admit it's a tiny one, so perhaps that's why you didn't notice it. It's “any character followed by an em dash”. As you noticed, it's not necessary to apply it to the next character as well. It's therefore also not necessary to include it in the GREP style.

    I've not quite wrapped my head around “look for this pattern but only apply the character style to these sub-elements of what you found”…any kind souls willing to point me in the right direction?

    That can be done in two ways. The first way only works with find-and-replace, and to use it you have to “mark” groups of characters to find with parentheses, (like) (this) — two groups. In the Replace With field, you refer to the found groups using $1, $2, $3 etc. (“$0″ is a special code for the entire found expression). So you can switch these two words around by putting “$2 $1″ into the Replace field. It's especially handy if you need to find “abc” and change only the “b” part. But —

    The other way to do it, is with Lookahead and Lookbehind. They are pretty cool features, with some amazing capabilities. What they do is look for text before and/or after what you want to find, but without marking them — they do not get highlighted when you press “Find Next”. Hence, they are not touched by anything you put in the Replace With field. Subscripting the “2″ in “H2O” is a good example, as you cannot do that with one regular Find/Replace. However, when Looking Behind for an “H”, searching for a “2″, and Looking Ahead for an “O”, you can do it in one go! This particular example would look like this:

    (?<=H)2(?=O)

    with this full explanation, provided by something I am (or should be) working on:

    (?<= Lookbehind Group

    H Literal text ‘H’

    ) End Lookbehind Group

    2 Literal text ‘2’

    (?= Lookahead Group

    O Literal text ‘O’

    ) End Lookahead Group

    in reply to: Grep Search #52299

    The slash doesn't :D Backslashes do, but the forward slash seems to be one of the handful non-alphanumerics that doesn't do anything. As far as I can tell, none of the characters in your sample need escaping.

    As with your “200 words” thingy, some of the spaces may have been entered as hard (non-breaking) spaces. Select “Show invisible characters” and check for these.

    You can also copy one of the lines and paste it into the Find what field of GREP — ID will convert any special characters to its GREP notation. It will not help if sometimes one space is entered as a hard space and on another occasion another space is, though.

    You can always change every single space in the string to , which is a catch-all for “any sort of space at all”.

    in reply to: GREP to bold products names? #55285

    .. Adobe InDesign some of the time, but just InDesign at other times. We don't want to bold the company name every time it's used, only when it's combined with the product name.

    You started out good, but made it a bit more complicated than necessary with the lookbehinds (as in: you are first checking if there is a “Company” before, then if there is not!).

    This works just fine:

    ((Adobe )?(InDesign|Illustrator|Photoshop))|((Quark )?(XPress|Promote))

    but it might be better to use separate GREP styles for each firm. Less hard work for poor Indy! Easier to maintain, as well. Like this:

    (Adobe )?(InDesign|Illustrator|Photoshop)

    (Quark )?(XPress|Promote)

    in reply to: Grep Search #55284

    How, in GREP, do you search for a string of specific words?

    You type them :-) Without any lookahead/lookbehind or other GREP conditions, what you enter is what it'll search. (At least for regular text and digits — other symbols may need escaping, because they might be GREP instructions.)

    It appears you want to find (and mark) this text and only when it's preceded by a digit. Well, the digit can be taken care of with a lookbehind, and the rest is a “regular” find. Try this:

    (?<=d) words in optional trims

    in reply to: GREP Style with Search/Replace? #52309

    .. I looked into if GREP had it's own Search/Replace built-in ..

    Say whuh? You would like to do a Search-and-replace inside a GREP expression or something like that?

    You are correct about the GREP styles, though — all they can do is apply formatting. I don't think it would be a wise move to “automagically” have it replace text … see also the discussion in one of the GREP Style threads on why it's a bad, bad idea to use GREP to “hide” double spaces and typos.

    You can try this: apply a style with lots of tracking (+100 or more) to

    .~_

    in reply to: GREP to bold products names? #52277

    .. Adobe InDesign some of the time, but just InDesign at other times. We don't want to bold the company name every time it's used, only when it's combined with the product name.

    You started out good, but made it a bit more complicated than necessary with the lookbehinds (as in: you are first checking if there is a “Company” before, then if there is not!).

    This works just fine:

    ((Adobe )?(InDesign|Illustrator|Photoshop))|((Quark )?(XPress|Promote))

    but it might be better to use separate GREP styles for each firm. Less hard work for poor Indy! Easier to maintain, as well. Like this:

    (Adobe )?(InDesign|Illustrator|Photoshop)

    (Quark )?(XPress|Promote)

    in reply to: Grep Search #52295

    How, in GREP, do you search for a string of specific words?

    You type them :-) Without any lookahead/lookbehind or other GREP conditions, what you enter is what it'll search. (At least for regular text and digits — other symbols may need escaping, because they might be GREP instructions.)

    It appears you want to find (and mark) this text and only when it's preceded by a digit. Well, the digit can be taken care of with a lookbehind, and the rest is a “regular” find. Try this:

    (?<=d) words in optional trims

    in reply to: Missing Plug-ins in CS4 #55273

    I think the only way is to save them as INX (or, since this is CS4, its bigger cousin IDML) and then open that. Saving in these “compatible” formats strips out everything that's not actually used (and — very occasionally — sometimes stuff that was in use so don't delete your original files just yet).

    in reply to: Split text into separate non-threaded frames? #55272

    Or adobe wants only smart intelligent people to script …

    They might — or they might want to scare off everyone (see their implementation of what should have been a simple programmer's editor…). I disliked their complicated Help system so much I rewrote it in friendly HTML, and since it allows backtracking from one object to another, I found this with relative ease:

    newframe is a TextFrame, so entered that in Search. Nothing useful there on columns, but I noticed TextFramePreferences (Adobe's preferred way of adding yet even more properties to objects). Clicked that, found this: textColumnCount. TextFramePreferences is used as a property value for a few things, and one of them is TextFrame.textFramePreferences. Adding all together, I think you can safely say:

    newframe.textFramePreferences.textColumnCount = 1;

    at any place you find convenient.

    By the way, yes! I was lazy, putting in that Fit Frame quick hack, and your solution is way better! It now works the way I envisioned it, 'cutting' right through the frame and leaving everything else intact.

    in reply to: Missing Plug-ins in CS4 #52285

    I think the only way is to save them as INX (or, since this is CS4, its bigger cousin IDML) and then open that. Saving in these “compatible” formats strips out everything that's not actually used (and — very occasionally — sometimes stuff that was in use so don't delete your original files just yet).

    in reply to: Split text into separate non-threaded frames? #52273

    Or adobe wants only smart intelligent people to script … 

    They might — or they might want to scare off everyone (see their implementation of what should have been a simple programmer's editor…). I disliked their complicated Help system so much I rewrote it in friendly HTML, and since it allows backtracking from one object to another, I found this with relative ease:

    newframe is a TextFrame, so entered that in Search. Nothing useful there on columns, but I noticed TextFramePreferences (Adobe's preferred way of adding yet even more properties to objects). Clicked that, found this: textColumnCount. TextFramePreferences is used as a property value for a few things, and one of them is TextFrame.textFramePreferences. Adding all together, I think you can safely say:

    newframe.textFramePreferences.textColumnCount = 1;

    at any place you find convenient.

    By the way, yes! I was lazy, putting in that Fit Frame quick hack, and your solution is way better! It now works the way I envisioned it, 'cutting' right through the frame and leaving everything else intact.

    in reply to: Split text into separate non-threaded frames? #55262

    A previous version of this forum translated straight quotes into curly ones, which is fine & dandy for plain text, making it more typographically sound, but it wreaked havoc with scripts.

    Now there is a new 'beautifying' daemon at work which I haven't met before: space dash space is automatically translated into en-dashes. Also much nicer on the eye, but .. also killing the option to post a script in-line and have it copied and pasted straight into the ESTK.

    ** (David, can you ask Pariah to add a “Pre” formatting button in the toolbar? Pretty please?) **

    So the good news is, you did everything correct, copying, saving, and testing. Open the script in the ESTK and edit the file, changing dashes into regular hyphens; save it and it should work. There should be five instances of space dash space to change; if ln. 10 is the first one, the others are on ln. 13, 14 (twice), and 15.

    in reply to: Parameters and events #55256

    It may also be an “illegal” character anywhere in the path name.

    “Illegal” is … anything not 'a' to 'z', '0' to '9' — it has something to do with Snow Leopard.

    in reply to: Split text into separate non-threaded frames? #55255

    That sounds as if you started out real old style, cutting paper strips and pasting them with wax. I did that as well for some time. Does this script work for you? It's rigged to only cut on paragraph breaks, and only if the frame is not threaded to a previous one. It cuts right above the current paragraph; all you have to do is position your cursor somewhere after the paragraph you want to split off and run the script. For four separate frames, you have to “cut” three times — but then again, you can always assign a shortcut key to the script.

    //DESCRIPTION:CopyCutter — Cut your Copy at the Cursor
    // Jongware, 24-Mar-2010

    if (app.selection.length == 1 && app.selection[0] instanceof InsertionPoint)
    {
    if (app.selection[0].parentTextFrames[0].previousTextFrame == null &&
    app.selection[0].paragraphs.previousItem(app.selection[0].paragraphs[0]) != null)
    {
    oldframe = app.selection[0].parentTextFrames[0];
    topline = app.selection[0].paragraphs[0].baseline;
    newframe = oldframe.duplicate();
    newframe.characters.itemByRange(app.selection[0].paragraphs[0].index – app.selection[0].parent.paragraphs[0].index-1, newframe.characters.lastItem().index).remove();
    oldframe.paragraphs.itemByRange(oldframe.paragraphs[0], app.selection[0].paragraphs.previousItem(app.selection[0].paragraphs[0])).remove();
    newframe.fit (FitOptions.FRAME_TO_CONTENT);
    vdiff = topline – oldframe.characters[0].baseline;
    newheight = oldframe.geometricBounds[2] – oldframe.geometricBounds[0] – vdiff;
    oldframe.geometricBounds = [oldframe.geometricBounds[2] – newheight, oldframe.geometricBounds[1], oldframe.geometricBounds[2], oldframe.geometricBounds[3]];
    }
    }

Viewing 15 posts - 1,126 through 1,140 (of 1,335 total)