Forum Replies Created
-
AuthorPosts
-
Theunis De Jong
MemberA 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.
Theunis De Jong
MemberIt 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.
Theunis De Jong
MemberThat 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-2010if (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]];
}
}Theunis De Jong
MemberA 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.
Theunis De Jong
MemberIt 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.
Theunis De Jong
MemberThat 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-2010if (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]];
}
}March 23, 2010 at 8:47 am in reply to: Is there a script to combine selected frames as Threaded Text #55240Theunis De Jong
Member.. the latest version will only work if you have text in all the frames you are linking.
Good catch — I did think of making a separate test for it but actually did not because I didn't think you would do that, as I thought there would be no point in linking an empty frame in the middle of a thread …
If I can find some more time, I might look into it (no promise …).
Theunis De Jong
MemberEhm. You mean, where the registered mark is already drawn as a superscript, rather than normal?
It differs per font …
March 23, 2010 at 1:47 am in reply to: Is there a script to combine selected frames as Threaded Text #52213Theunis De Jong
Member.. the latest version will only work if you have text in all the frames you are linking.
Good catch — I did think of making a separate test for it but actually did not because I didn't think you would do that, as I thought there would be no point in linking an empty frame in the middle of a thread …
If I can find some more time, I might look into it (no promise …).
Theunis De Jong
MemberEhm. You mean, where the registered mark is already drawn as a superscript, rather than normal?
It differs per font …
Theunis De Jong
MemberI forgot the editor eats lonely backslashes for dinner. That ought to be
(?<=d)”
Now it's real easy to find out how to do this with single quotes

Theunis De Jong
Member(Having a slight deja-vu — GREP with hyphens with various numbers? But let me repeat it here, in case someone else has the exact same question.)
Search for
(?<=d)”
Replace with
~”
The search works because it looks for “a digit on the left”, followed by any sort of double quote — typing ” in a Search expression will have InDesign automatically look for both straight and curly, both open and closed, double quotes.
The replace works because usually InDesign automatically translates a single ” into the required open or closed double curly quote, but the notation ~” means it should not do that and insert a literal double “.
Theunis De Jong
MemberFile contains 2 placed illustrator files (CMYK, but only used black and spots) …
Isn't that the trigger — CMYK? (You don't mention it, but you must be using Yellow somewhere as well.)
March 22, 2010 at 1:49 pm in reply to: Is there a script to combine selected frames as Threaded Text #55223Theunis De Jong
MemberGood! — One thing left to do, here is a version that changes the last hard return into a Frame Break, or in case there is no return, adds the break.
Man I need to learn how to script.
Why not have a go thinking of something you'd like to script and see how far you get? The JS Guide over at Adobe's (InDesign section, “Scripting Stuff” button) has a lot of snippets for common tasks, so you can cut 'n' paste entire sections to make something new. And there always is the Adobe Scripting forum for the odd question left.
Anyway, here is the amended script. The changed section is around the “combine me with next” clause.
var combineMe = new Array;
for (a=0; a<app.selection.length; a++)
{
if (app.selection[a] instanceof TextFrame)
combineMe.push(app.selection[a]);
}
combineMe.sort (function (a,b) { return (a.geometricBounds[0] < b.geometricBounds[0]) || (a.geometricBounds[0] == b.geometricBounds[0] && a.geometricBounds[1] < b.geometricBounds[1]) ? -1 : 1; } );for (a=0; a<combineMe.length-1; a++)
{
if (combineMe[a].nextTextFrame == null)
{
nextFree = a+1;
while (nextFree < combineMe.length && combineMe[nextFree].previousTextFrame != null)
nextFree++;
if (nextFree < combineMe.length)
{
// Add Frame Break when needed:
if (combineMe[a].characters[-1].contents != SpecialCharacters.FRAME_BREAK)
{
if (combineMe[a].characters[-1].contents == “r”)
combineMe[a].characters[-1].contents = SpecialCharacters.FRAME_BREAK;
else
combineMe[a].insertionPoints[-1].contents = SpecialCharacters.FRAME_BREAK;
}
combineMe[a].nextTextFrame = combineMe[nextFree];
}
}
}Theunis De Jong
MemberI forgot the editor eats lonely backslashes for dinner. That ought to be
(?<=\d)”
Now it's real easy to find out how to do this with single quotes

-
AuthorPosts
