Copiar link para a área de transferência
Copiado
I have selected some text, tables, and images, and I want to apply object styles(exapmle name:"AA") to the images.
How do I capture these images?
Sometimes they are imported from Word without links. Other times, they may be linked.
This is the original code for capturing the table:
if (app.selection != null) {
for (var f = 0; f < app.selection.length; f++) {
var obj = app.selection[f];
var t = obj.texts[0].tables;
. . .
}
//a selection’s graphics as an array
var sg = app.selection[0].allGraphics
alert("There are " + sg.length + " graphics in the selection")
if (sg != null) {
for (var f = 0; f < sg.length; f++) {
sg[f].appliedObjectStyle = app.activeDocument.objectStyles.itemByName("AA");
}
}
Copiar link para a área de transferência
Copiado
//a selection’s graphics as an array
var sg = app.selection[0].allGraphics
alert("There are " + sg.length + " graphics in the selection")
if (sg != null) {
for (var f = 0; f < sg.length; f++) {
sg[f].appliedObjectStyle = app.activeDocument.objectStyles.itemByName("AA");
}
}
Copiar link para a área de transferência
Copiado
Hi rob day.
Thank you very much.
It seems that the object style has not been applied successfully.
I saw it.
It seems that the white arrow is the only one that shows the effect?
Copiar link para a área de transferência
Copiado
It seems that the object style has not been applied successfully.
It is in my example—it’s been set to your AA object style.
Note that it has to be:
Copiar link para a área de transferência
Copiado
Clear object style priority. Is there any other code?
I don't know if this works.
sg[f].clearObjectStyleOverrides()
I've always wanted to ask, I can't manually clear the “+” on object style AA.
Even when I press the Alt key.
Copiar link para a área de transferência
Copiado
Is it possible to clear the object style priority?
This does not seem to work for object styles.
Even if I set it in the object style, the frame does not seem to be removed.
I may need to add FRAME_TO_CONTENT.
Copiar link para a área de transferência
Copiado
I don’t understand, when I apply the style to your sample with my script I get this
Copiar link para a área de transferência
Copiado
I set AA.
Proportionally fit content. Size is 42mm.
Copiar link para a área de transferência
Copiado
Thank you
Copiar link para a área de transferência
Copiado
Hi rob day.
How can I capture an image when no object is selected?
It seemed to work fine before.
It's just that alert(g.length) seems to be wrong.
alert(g); and alert(g.length); seem to have different quantities.
alert(g); resut is this:
but alert(g.length); resut is 2.
function noSelect() {
var myDocument = app.documents.item(0);
var myStory = myDocument.stories;
var p = myStory.everyItem().paragraphs.everyItem();
var c = myStory.everyItem().tables.everyItem().cells;
var t = myStory.everyItem().tables;
var g = myStory.everyItem().allGraphics;
alert(g);
alert(g.length);
for (var s = 0; s < myStory.length; s++) {
...
if (g != null) {
for (var f = 0; f < g.length; f++) {
g[f].clearObjectStyleOverrides();
g[f].parent.appliedObjectStyle = app.activeDocument.objectStyles.itemByName(initImObjStn);
g[f].fit(FitOptions.FRAME_TO_CONTENT);
}
}
Encontre mais inspiração, eventos e recursos na nova comunidade da Adobe
Explore agora