Forum Replies Created
-
AuthorPosts
-
Theunis De Jong
MemberHuh — 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.
Theunis De Jong
MemberTrial 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.
Theunis De Jong
Member(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);}
Theunis De Jong
MemberDesignate 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.
Theunis De Jong
MemberThat oughtn'tn'tt've happened. Which of the two GREPs are you using? (They don't mix!)
Theunis De Jong
MemberOnly 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
Theunis De Jong
MemberKasyan, it's okay to use forward slashes in an InDesign script – even under Windows.
Theunis De Jong
MemberWe 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.)
October 14, 2011 at 6:24 am in reply to: Changing the paragraph style of the NEXT paragraph using Find or GREP #60763Theunis De Jong
Member… 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;
}
}
}October 14, 2011 at 6:06 am in reply to: Changing the paragraph style of the NEXT paragraph using Find or GREP #60762Theunis De Jong
MemberI 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.
October 14, 2011 at 5:29 am in reply to: Changing the paragraph style of the NEXT paragraph using Find or GREP #60760Theunis De Jong
MemberAh, how ingenious mr. Bunt.
Actually, I may have used your method before I knew how to script and thus had to use my brains!
Theunis De Jong
MemberUse move to move an image.
October 13, 2011 at 2:54 pm in reply to: Changing the paragraph style of the NEXT paragraph using Find or GREP #60753Theunis De Jong
Member.. 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”;October 13, 2011 at 2:51 pm in reply to: Changing the paragraph style of the NEXT paragraph using Find or GREP #60752Theunis De Jong
MemberCan't be done, it needs a script.
October 11, 2011 at 3:12 am in reply to: Animation conumdrum: Is an Auto slideshow possible in IDCS5? #60738Theunis De Jong
MemberI 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.
-
AuthorPosts
