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

Replace external PDF JobOptions

New Here ,
May 02, 2023 May 02, 2023

Copy link to clipboard

Copied

Hello, 

I work on Windows, and for my client I test on Mac and windows. 

 

I use importFile into a plugin for Indesign to get any pdfExportPresetFormat that a service send me.

 

It's ok, but when I recall that function to get an updated version of my pdfExportPresetFormat, I have a new one instead : 

- myPreset

- myPreset_1

- myPreset_2

...

 

I want to replace the first .jobOptions with a new one with the same name, so

function importPresetFile(filepath, name) {
    if (app.pdfExportPresets.item(name) != null) {
        app.pdfExportPresets.item(name).remove();
    }
    app.importFile(ExportPresetFormat.pdfExportPresetsFormat, filepath);
}

 

Sometimes it works, but sometimes the right to delete is not acquired, and I can just import the same document at the end of the list.

I checked this forum and the doc, maybe I am missing something, please help me.

Tanks in advance.

TOPICS
Scripting

Views

171

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
People's Champ ,
May 02, 2023 May 02, 2023

Copy link to clipboard

Copied

LATEST

Maybe try:

 

function importPresetFile(filepath, name) {
    
    var pst = app.pdfExportPresets.itemByName(name);
    pst.isValid && pst.remove();

    app.importFile(ExportPresetFormat.pdfExportPresetsFormat, filepath);
}

 

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