Copy link to clipboard
Copied
I want text out the group and throw this into the textframe but I can't. Please, help me. Thanks a lot.
Thanks!
Don't forget it's Christmas soon and some bottles are over yet! …
… If I understood what you mean, you have this:
As I saw, you seem to use a "condition"! … and you would like to get this!
For that, try this [just change the condition name! Here = "Test"]:
...app.doScript("main()", ScriptLanguage.javascript, undefined, UndoModes.ENTIRE_SCRIPT, "Extract Conditional Text! …");
function main()
{
var myDoc = app.activeDocument;
var myCondition = "Test";
app.findGrepPr
Copy link to clipboard
Copied
You might want to ask in the InDesign Scripting forum:
Copy link to clipboard
Copied
You mean: extract text frames from group?
Take a look at this thread, there are good working samples.
Copy link to clipboard
Copied
Thanks. It works but I don't need that one. I wanna take out groups items not on the pasteboard. It should be on the same page that I have taken.
Copy link to clipboard
Copied
üSTÜNE ÇİKOLATA SOSUDA İSTERMİSİN
Copy link to clipboard
Copied
Sure, of course.
Copy link to clipboard
Copied
Hi,
Screenshot! Thanks!
(^/)
Copy link to clipboard
Copied
Before:
And After:
Thanks.
Copy link to clipboard
Copied
Thanks!
Don't forget it's Christmas soon and some bottles are over yet! …
… If I understood what you mean, you have this:
As I saw, you seem to use a "condition"! … and you would like to get this!
For that, try this [just change the condition name! Here = "Test"]:
app.doScript("main()", ScriptLanguage.javascript, undefined, UndoModes.ENTIRE_SCRIPT, "Extract Conditional Text! …");
function main()
{
var myDoc = app.activeDocument;
var myCondition = "Test";
app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.appliedConditions = [myCondition];
var myFound = myDoc.findGrep();
var F = myFound.length;
for (i = 0; i < F ; i++){
var myF = myFound;
myF.parent.texts.everyItem().appliedConditions = [];
if ( ( myP = myF.parentTextFrames[0].parent.parent ) instanceof Character )
{
myF.parent.texts.everyItem().move(LocationOptions.BEFORE, myP);
myP.contents = "\r";
}
else if ( ( myP = myF.parentTextFrames[0].parent ) instanceof Character )
{
myF.parent.texts.everyItem().move(LocationOptions.BEFORE, myP);
myP.contents = "";
}
}
alert(F + " done!\r\rMerry Christmas and Happy Holidays!!\r\r(^/)")
}
It's a simple Grep research based on your condition! …
What else! … Maybe a new toast! Hips!
(^/)
Copy link to clipboard
Copied
Thanks for everything. Happy Christmas. 😄
Copy link to clipboard
Copied
… It's not because The Force is a powerful ally that things seem to be so simple! …
… and, according to my master Yoda:
"Full of certainties you are, not a Jedi you'll become!"
This script new version is formidable because it preserves the styles applied!
app.doScript("main()", ScriptLanguage.javascript, undefined, UndoModes.ENTIRE_SCRIPT, "Extract Conditional Text! …");
function main()
{
var myDoc = app.activeDocument,
myCondition = "Test";
app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.findWhat = "(?-s).+";
app.findGrepPreferences.appliedConditions = [myCondition];
app.changeGrepPreferences.changeTo = "\\r$0\\r";
myDoc.changeGrep();
app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.findWhat = "(?s).+";
app.findGrepPreferences.appliedConditions = [myCondition];
var myFound = myDoc.findGrep(),
F = myFound.length;
for (i = 0; i < F ; i++){
var myF = myFound;
myF.parent.texts.everyItem().appliedConditions = [];
if ( ( myP = myF.parentTextFrames[0].parent.parent ) instanceof Character || ( myP = myF.parentTextFrames[0].parent ) instanceof Character )
{
myF.parent.texts.everyItem().move (LocationOptions.BEFORE, myP);
myP.contents = "";
}
}
app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.findWhat = "^\\h*\\r";
app.changeGrepPreferences.changeTo = "";
myDoc.changeGrep();
app.findGrepPreferences = app.changeGrepPreferences = null;
alert( F + " done!\r\rMerry Christmas and Happy Holidays!!\r\r(^/)" )
}
[To be evaluated!] Thanks for your comments!
(^/)
Copy link to clipboard
Copied
Thanks to definitively make this last answer as "correct"!
Thanks!
(^/)
Copy link to clipboard
Copied
Great! 😄 Thank you so much. Really does work it.