Copy link to clipboard
Copied
Hi All,
Facing issues while placing grouped library assets in the active document.
No issues while placing assets as a single text frame.
Code is below:
var myDoc = app.activeDocument;
var myLib = app.libraries[0];
app.findTextPreferences = app.changeTextPreferences = null;
app.findTextPreferences.appliedParagraphStyle = "tx"
var myFound = myDoc.findText()
for(k=myFound.length-1; k>-1; k--)
{
var myAnno = myFound
.texts[0] var myPlaceAsset = myLib.assets.item("aaa").placeAsset(myFound
.insertionPoints[-1])[0]; myAnno.move(LocationOptions.AT_END, myPlaceAsset); //I think Problem here only
myPlaceAsset.appliedObjectStyle = myDoc.objectStyles.item("bbb")
}
Please find the screenshot for your more reference.
Could anyone please help me for the group library assets.
Thanks in advance
Beginner
Hi,
In case of placing a group your code is trying to move some text - without container - into the group ==> so it fails
Try to modify the code including additional variable mRef as a move reference parameter, so:
...
var mRef = myPlaceAsset;
if (mRef.textFrames.length >0)
mRef = mRef.textFrames[0];
myAnno.move(LocationOptions.AT_END, mRef);
...
Jarek
Copy link to clipboard
Copied
Hi,
In case of placing a group your code is trying to move some text - without container - into the group ==> so it fails
Try to modify the code including additional variable mRef as a move reference parameter, so:
...
var mRef = myPlaceAsset;
if (mRef.textFrames.length >0)
mRef = mRef.textFrames[0];
myAnno.move(LocationOptions.AT_END, mRef);
...
Jarek
Copy link to clipboard
Copied
Hi Jump_Over,
Extremely Sorry for the late response....
Above coding working fine to cut and move the "tx" style in Marginal Notes("aaa").
But facing the new problem is,
If we apply the object style to the Marginal box, fill color properties is lost.
Could you have any solution for this.
var myDoc = app.activeDocument;
var myLib = app.libraries[0];
app.findTextPreferences = app.changeTextPreferences = null;
app.findTextPreferences.appliedParagraphStyle = "tx"
var myFound = myDoc.findText()
for(k=myFound.length-1; k>-1; k--)
{
var myAnno = myFound
.texts[0] var myPlaceAsset = myLib.assets.item("aaa").placeAsset(myFound
.insertionPoints[-1])[0]; var mRef = myPlaceAsset;
mRef = mRef.textFrames[0];
myAnno.move(LocationOptions.AT_END, mRef);
myPlaceAsset.appliedObjectStyle = myDoc.objectStyles.item("bbb")
}
Please find the screenshot:
Thanks in advance
Beginner_X
Copy link to clipboard
Copied
Hi All,
Could anyone please help for the above request.
Thanks in advance
Beginner
Copy link to clipboard
Copied
Edit:
define the objectstyle for the group with option for fillcolor switched off!!! so it won't change a existing fillcolor
Copy link to clipboard
Copied
Hi Jump_Over & hans,
Thanks a lot genius!!!!
Above threads are very helpful for me to find the solution.
But now I try to learn myself with different task, but cant reach the destination.
Is it possible to move the next paragraph move into the library assets
i.e.,
var myAnno = myFound
.texts[0]; //~ alert("myAnno:" + myAnno)
var myAnno1 = myFound[k+1].texts[0];
//~ alert("myAnno1:" + myAnno1); //Here is the problem
var myPlaceAsset = myLib.assets.item("aaa").placeAsset(myFound
.insertionPoints[-1])[0]; var mRef = myPlaceAsset;
mRef = mRef.textFrames[0];
myAnno1.move(LocationOptions.AT_END, mRef);
Could anyone please help to give the solution.
Thanks
Beginner
Copy link to clipboard
Copied
Hi All,
Could anyone please help for the above request.
Thanks
Beginner
Copy link to clipboard
Copied
Hi Beginner,
Try the below code.
Insert the below codes after ur codes.
app.select(app.selection[0].insertionPoints[-1]);
app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.findWhat = ".+";
var xxx = app.findGrep(); //var xxx = app.insertionPoints[0].findGrep();
app.select(xxx[0]);
app.cut();
app.select(mRef.insertionPoints[0]);
app.paste();
Note:
Currently, I can't able to check my code works. Becoz i'm out of city. Use, If it works. Else ignore.
Thanks and Regards,
Vel.
Copy link to clipboard
Copied
Hi Velprakash,
The above coding not help to find the solution.
Anyway thanks for your extra ordinary effort.....
Jump_Over & Hans your coding helps to find for my initial solution.
Always I thankful for you.
Thanks
Beginner_X
Find more inspiration, events, and resources on the new Adobe Community
Explore Now