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

Can i Make user Select JPG Setting from the Origianl InDesign JPG Setting Dialog

Enthusiast ,
Jun 15, 2020 Jun 15, 2020

Copy link to clipboard

Copied

//set properties for export to your needs
 with(app.jpegExportPreferences){ 
antiAlias = true; 
embedColorProfile = false; 
exportResolution = 300; 
jpegColorSpace = JpegColorSpaceEnum.RGB; //JpegColorSpaceEnum.CMYK, JpegColorSpaceEnum.GRAY     r/w    One of RGB, CMYK or Gray 
jpegQuality = JPEGOptionsQuality.HIGH; //JPEGOptionsQuality.LOW, JPEGOptionsQuality.MEDIUM, JPEGOptionsQuality.HIGH, JPEGOptionsQuality.MAXIMUM     r/w    The compression quality. 
jpegRenderingStyle = JPEGOptionsFormat.BASELINE_ENCODING; // JPEGOptionsFormat.PROGRESSIVE_ENCODING     r/w    The rendering style. 
simulateOverprint = true; 
} 

I wrote a code for JPG setting but can i make the user to use the original Export JPG Shipped with InDesign? How to Do  that ? Thanks in Advance ?

Best
Mohammad Hasanin
TOPICS
Scripting

Views

426

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 , Jun 16, 2020 Jun 16, 2020

The answer is No, you can't let the user use InDesign's export window. That goes for all windows, not just JPEG export window. You have two options: (1) write a script that recreates InDesign's JPEG export window and (2) let the user create a small text file with the required data, which your script interprets.

 

Option (1) is easy on the user, hard on you. Option (2) is easy on you, a little bit harder on the user.

 

P.

Votes

Translate

Translate
Community Expert ,
Jun 15, 2020 Jun 15, 2020

Copy link to clipboard

Copied

Hi medos20,

if you do not define anything with jpegExportPreferences the export will use the preferences exactly like the user left them. So principally you need nothing to do code side.

 

However, if you want to restore settings you first have to save them to a variable. For that you can use the properties property of the jpegExportPreferences like that:

 

// Fetch the current values:
var userJpegExportPreferences = app.jpegExportPreferences.properties ;

// Set the new values:
app.jpegExportPreferences.properties =
{
	antiAlias : true ,
	embedColorProfile : false ,
	exportResolution : 300 ,
	jpegQuality : JPEGOptionsQuality.HIGH ,
	jpegRenderingStyle  : JPEGOptionsFormat.BASELINE_ENCODING ,
	simulateOverprint : true
};

/*
	Do your JPEG export here.
	... 
	
*/

// Restore the old values:
app.jpegExportPreferences.properties = userJpegExportPreferences ;

 

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
Enthusiast ,
Jun 15, 2020 Jun 15, 2020

Copy link to clipboard

Copied

Thank you very much but i want the user to select the settings from dialog so the script will work dynamically.. i think i have to build custom dialog and connect variables. any way thank you very much for your reply

Best
Mohammad Hasanin

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 ,
Jun 15, 2020 Jun 15, 2020

Copy link to clipboard

Copied

Hi medos20,

no need to do your own UI.

You can use InDesign's own dialog.

 

There is the argument showingOptions for this in the exportFile method.

Or in method asynchronousExportFile if you prefer this. See into DOM documentation for both methods:

 

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Rectangle.html#d1e217191__d1e220251

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Rectangle.html#d1e217191__d1e219241

 

Example: If you want to export a selected rectangle on the page of a saved document you could do this:

var doc = app.documents[0];
var newJPEGfile = File( doc.fullName.toString().replace(/\.indd/i, "-"+Date.now()+".jpg" ) );

app.selection[0].exportFile
(
	ExportFormat.JPG ,
	newJPEGfile ,
	true
);

 

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
Enthusiast ,
Jun 15, 2020 Jun 15, 2020

Copy link to clipboard

Copied

Thank you very much , The problem that i want to export punch of files, so if i use this method indesign insist that i have to enter setting for each file!, Thanks a lot

Best
Mohammad Hasanin

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 ,
Jun 16, 2020 Jun 16, 2020

Copy link to clipboard

Copied

The answer is No, you can't let the user use InDesign's export window. That goes for all windows, not just JPEG export window. You have two options: (1) write a script that recreates InDesign's JPEG export window and (2) let the user create a small text file with the required data, which your script interprets.

 

Option (1) is easy on the user, hard on you. Option (2) is easy on you, a little bit harder on the user.

 

P.

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 ,
Jun 16, 2020 Jun 16, 2020

Copy link to clipboard

Copied

LATEST

Hi medos20,

it's a question of design. No need to invoke the same export function for all files you want to export.

Just do the first with user intervention for setting the export preferences, then do the rest of the exports in a different process. As already explained: InDesign will use the settings the user had defined the last time.

 

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