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

Can't set default Object style

Explorer ,
Jan 28, 2022 Jan 28, 2022

Copy link to clipboard

Copied

I have created a photo style that I want to automatically apply to all new photos in a document. 'Photo' has been selected as the Default Craphics Style. But when I import (CTRL-D) or drag and drop from the folder, it resolutely defaults to 'none'. How can I fix this?

TOPICS
How to

Views

219

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

correct answers 1 Correct answer

Community Expert , Jan 28, 2022 Jan 28, 2022

Yup. Been that way since day one. The default graphics frame is hard coded and nothing you do to edit it will work.

Votes

Translate

Translate
Community Expert ,
Jan 28, 2022 Jan 28, 2022

Copy link to clipboard

Copied

I just replicated the problem. It looks as if setting the default Graphics Object style is... ignored. Although creating a Text Frame with a different style selected as default works fine.


â•Ÿ Word & InDesign to Kindle & EPUB: a Guide to Pro Results (Amazon) â•¢

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 ,
Jan 28, 2022 Jan 28, 2022

Copy link to clipboard

Copied

Yup. Been that way since day one. The default graphics frame is hard coded and nothing you do to edit it will work.

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 ,
Jan 31, 2022 Jan 31, 2022

Copy link to clipboard

Copied

Hi Eriq49Morse,

I see the possibility to change the object style for all graphic frames that contain graphics after the placegun is loaded with graphics or images. The posted ExtendScript (JavaScript) code below is only a proof of concept and has no user interface. It will detect the default object style and applies it to all graphic frames that contain graphics that are loaded in the cursor (place gun) :

 

var doc = app.documents[0];
var placeGun = app.documents[0].placeGuns;
var placeGunContentsFirstLevel = placeGun.pageItems.everyItem().getElements();

// Detect the default object style:
var tempRect = doc.rectangles.add({ geometricBounds : [0,0,"50mm","50mm"] });
var defaultObjectStyle = tempRect.appliedObjectStyle;
tempRect.remove();

// Apply the detected default object style to all graphic frames in the place gun that contain graphics:

for( var n=0; n<placeGunContentsFirstLevel.length; n++ )
{
	var allGraphics = placeGunContentsFirstLevel[n].allGraphics;
	for( var g=0; g<allGraphics.length; g++ )
	{
		allGraphics[g].parent.appliedObjectStyle = defaultObjectStyle ;
	};
};

 

Note: You can run a script in the scripts panel of InDesign even if your cursor is loaded with graphics or images.

 

How to save ExtendScript (JavaScript) code to a script file:

Copy the code to a text editor where the empty file is opened with no formatting.
Save the file with suffix *.jsx

How to install a script file in InDesign:
Go to Window > Utilities > Scripts
In the Scripts panel, right click on User and choose Reveal in Finder (Mac) or Reveal in Explorer (PC)
Copy the script file inside the Scripts Panel folder

 

Execute the script from the Scripts panel either with a double-click on the script name or with the menu command in the context menu when the script name is selected.

 

Regards,
Uwe Laubender

( ACP )

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 ,
Jan 31, 2022 Jan 31, 2022

Copy link to clipboard

Copied

Very interesting. Is there a way to do this with a startup script by any chance? That would be the best new feature ever.

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 ,
Jan 31, 2022 Jan 31, 2022

Copy link to clipboard

Copied

Hi Peter,

I will think about it…

Tomorrow.

 

Regards,
Uwe Laubender

( ACP )

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 ,
Jan 31, 2022 Jan 31, 2022

Copy link to clipboard

Copied

Hi Uwe,

 

Alas, no luck. I save your I select Photo as the default graphics style, load the gun, run the jsx. script and...nothing happens. As I place the images from the gun, the style simply snaps back to None.

 

Here's the script as I copied and installed it.

Eriq49Morse_0-1643658744631.png

Eric

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 ,
Jan 31, 2022 Jan 31, 2022

Copy link to clipboard

Copied

No wonder.

You have to run it from the Scripts panel of InDesign.

 

Or you have to connect first to InDesign as target when you do it with the ExtendScript Toolkit CC ( ESTK ) .

Your screenshot is showing that the ESTK is connected with itself…

 

What's your version of InDesign you like to run it on?

You should see it in the dropdown where you now see "ExtendScript Toolkit CC".

 

Regards,
Uwe Laubender

( ACP )

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 ,
Jan 31, 2022 Jan 31, 2022

Copy link to clipboard

Copied

Not entirely sure I understand. I should say I know nothing at all of Java and have never heard of ExtendScript until now (is it a Mac application?). I am running it from the Scripts panel of InDesign 17.1 x 64 on Windows 10 if that helps.

 

The screenshot was simply to show you what I had cut and pasted from your original post into a text editor. I'm attaching the .jsx file (renamed .txt for posting) for your reference.

 

It may be that the solution is beyond my technical competence, so I think it best if I keep on applying the style manually. It's a massive project but I am now near the end.

 

Many thanks,

 

Eric

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 ,
Feb 01, 2022 Feb 01, 2022

Copy link to clipboard

Copied

"I am running it from the Scripts panel of InDesign 17.1 x 64 on Windows 10 if that helps."

 

Hi Eric,

alright. Then the script should work.

You have to run the script after your cursor is loaded with the images or graphics and none of the images is placed already.. I tested with a couple of JPEG images loaded to the cursor. InDesign 2022 version 17.0.1.105 on Windows 10. Version 17.1 is still not available here in Germany.

 

When I have time today I will add a few tests to the code that will inspect the contents of the loaded cursor and some alerts so that you know what's going on in every step of operation it takes.

 

Regards,
Uwe Laubender

( ACP )

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 ,
Feb 01, 2022 Feb 01, 2022

Copy link to clipboard

Copied

Many thanks Uwe. I'll do other layout chores in the meantime, heaven knows there are enough of them!

 

Eric

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 ,
Feb 01, 2022 Feb 01, 2022

Copy link to clipboard

Copied

LATEST

Well, no idea what I did, but now it works!

Of course, a startup script would be ideal!

Many thanks again.

Eric

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