Highlighted

Adding swatches to a batch process | update templates

Contributor ,
Jul 01, 2020

Copy link to clipboard

Copied

I have 3 lines of code that work great for batch processing the updating of styles:

 

targetDoc.importStyles(ImportFormat.CHARACTER_STYLES_FORMAT, sourceFile, GlobalClashResolutionStrategy.LOAD_ALL_WITH_OVERWRITE);
targetDoc.importStyles(ImportFormat.PARAGRAPH_STYLES_FORMAT, sourceFile, GlobalClashResolutionStrategy.LOAD_ALL_WITH_OVERWRITE);
targetDoc.importStyles(ImportFormat.OBJECT_STYLES_FORMAT, sourceFile, GlobalClashResolutionStrategy.LOAD_ALL_WITH_OVERWRITE);

 

Could someone offer a line that includes the Swatches in this?    🙂

Hello MadMac55,

This should work for your needs.

try{ targetDoc.loadSwatches(sourceFile); } catch (e){}

 

 

Regards,

Mike

TOPICS
Print, Scripting

Views

77

Likes

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

Adding swatches to a batch process | update templates

Contributor ,
Jul 01, 2020

Copy link to clipboard

Copied

I have 3 lines of code that work great for batch processing the updating of styles:

 

targetDoc.importStyles(ImportFormat.CHARACTER_STYLES_FORMAT, sourceFile, GlobalClashResolutionStrategy.LOAD_ALL_WITH_OVERWRITE);
targetDoc.importStyles(ImportFormat.PARAGRAPH_STYLES_FORMAT, sourceFile, GlobalClashResolutionStrategy.LOAD_ALL_WITH_OVERWRITE);
targetDoc.importStyles(ImportFormat.OBJECT_STYLES_FORMAT, sourceFile, GlobalClashResolutionStrategy.LOAD_ALL_WITH_OVERWRITE);

 

Could someone offer a line that includes the Swatches in this?    🙂

Hello MadMac55,

This should work for your needs.

try{ targetDoc.loadSwatches(sourceFile); } catch (e){}

 

 

Regards,

Mike

TOPICS
Print, Scripting

Views

78

Likes

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
Jul 01, 2020 0
Engaged ,
Jul 01, 2020

Copy link to clipboard

Copied

Hello MadMac55,

What you're looking for is " loadSwatches ()"

https://www.indesignjs.de/extendscriptAPI/indesign-latest/index.html#Document.html#d1e49241__d1e5440...

 

you can find an example at the bottom of the post in the link below to see how it's being executed.

https://indisnip.wordpress.com/2010/08/24/import-styles-from-file/

 

Regards,

Mike

 

 

 

Likes

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
Reply
Loading...
Jul 01, 2020 1
Contributor ,
Jul 01, 2020

Copy link to clipboard

Copied

Thank you so much, Mike.  What a great resource.  I should be able to figure out a statement from these two links.

Likes

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
Reply
Loading...
Jul 01, 2020 0
Engaged ,
Jul 02, 2020

Copy link to clipboard

Copied

Hello MadMac55,

This should work for your needs.

try{ targetDoc.loadSwatches(sourceFile); } catch (e){}

 

 

Regards,

Mike

Likes

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
Reply
Loading...
Jul 02, 2020 1
MadMac55 LATEST
Contributor ,
Jul 02, 2020

Copy link to clipboard

Copied

Just awesome.  You are simply so generous to help me. 

Likes

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
Reply
Loading...
Jul 02, 2020 0