• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

How can I resize graphic with attribute?

Explorer ,
Mar 19, 2024 Mar 19, 2024

Copy link to clipboard

Copied

hello.

I have a question about scripting to resize graphic.

This is the script to resize graphic

 

doc = app.ActiveDoc;

graphicObj = doc.FirstGraphicInDoc;

while(graphicObj.ObjectValid()) {

graphicObj = graphicObj.NextGraphicInDoc;

if(graphicObj.type == Constants.FO_Inset) {

name = graphicObj.InsetFile;

graphicObj.InsetDpi=300;

}

}

but I want to resize graphic only having attribute placement "break"
How can I do this with script??

TOPICS
Scripting

Views

3.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 20, 2024 Mar 20, 2024

Copy link to clipboard

Copied

var element, value;

element = graphicObj.Element;
value = getAttributeValue (element, "break");

function getAttributeValue (element, name) {
    
	/// value = getAttributeValue (element, name);
	
    var attrList = element.Attributes, i = 0;
    
    for (i = 0; i < attrList.length; i += 1) {
        if (attrList[i].name === name) {
            if (attrList[i].values[0] !== undefined) {
                return (attrList[i].values[0]);
            }
        }
    }
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 20, 2024 Mar 20, 2024

Copy link to clipboard

Copied

hello.
I tried but It is not working.

On ESTK, I can see there is the problem.

 

var attrList = element.Attributes, i = 0;

 

but I don't think it is only reason about it.
maybe my script is basically focus on graphic object and it seems like it doesn't have attribue because
it is not an element.
should I find out script with another way for resize the image?




Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 21, 2024 Mar 21, 2024

Copy link to clipboard

Copied

Is your document structured? Can you send a screenshot of the Structure View at the image element? Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 21, 2024 Mar 21, 2024

Copy link to clipboard

Copied

hello.
here is my structure view.

When its attribute "placement" is "break"

I want to resize image with 300 dpi.

20240322_151949.png

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 22, 2024 Mar 22, 2024

Copy link to clipboard

Copied

LATEST

I am sorry about the incorrect code. Replace this:

element = graphicObj.Element;

with this:

element = graphicObj.FrameParent.Element;

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines