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

.AI file to a LR .PDF in a particular folder and adding _LR to the name

Community Beginner ,
Nov 09, 2018 Nov 09, 2018

Copy link to clipboard

Copied

Hey,

I'm figuring out how to work with scripting and I did some reading in the scripting section, but that's all kinda chinese for me.

I'll explain what I just need:

1. I open a file ( named: FileA-ontwerp ) from folder A

2. I customize it

3. THIS IS WHERE I NEED MY SCRIPT FOR ( MAYBE WITH A KEYBOARD SHORTCUT ( F2 ) ? )

-> I want to save it in the ' smallest file size ' presets + adding a password and the name of the file should be 'FileA-ontwerp_LR.pdf' ( see attachment )

and it should be saved in the same folder A.

LR PDF-01.jpg

I tried this with an action and it works, BUT it takes the name from the file I recorded the action with and it saves the file in the folder of that preview file.

So not really the best system for me.

Is there anyone whoe can help me with this ? I don't have any scripting of js knowledge. If it's only possible with scripting, can someone tell me how i should implement a script please ?

Thanks in advance !

Tatiana

TOPICS
Scripting

Views

603

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
Adobe
Valorous Hero ,
Nov 09, 2018 Nov 09, 2018

Copy link to clipboard

Copied

You should be able to use the following script. If you have the latest version of Illustrator, you can record playing this script into an action via Insert menu item command inside the flyout menu of the Actions panel. Such an action can have a hotkey assigned to it within Illustrator.

First you have to save the following text as a .jsx extension inside the Illustrator's application folder inside of the Presets/Scripts folder so that it appears in your File > Scripts menu as a menu item.

//@target illustrator

function test(){

  if(app.documents.length == 0){

    alert("No documents are open.");

    return;

  }

  var doc = app.activeDocument;

  if(doc.fullName.toString().length - doc.fullName.toString().replace(/\//g, "").length <= 1){

    alert("Ensure open document is saved first.");

    return;

  }

  alert("Proceed");

  var opts = new PDFSaveOptions();

  opts.pdfPreset = "[Smallest File Size]";

  opts.permissionPassword = "abc123";

  opts.requirePermissionPassword = true;

  opts.enableCopy = false;

  opts.enableCopyAccess = false;

  opts.pdfChangesAllowed = PDFChangesAllowedEnum.CHANGE128NONE;

  var newFile = File(doc.fullName.toString().replace(".ai", "_LR.pdf"));

  doc.saveAs(newFile, opts);

};

test();

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 Beginner ,
Nov 20, 2018 Nov 20, 2018

Copy link to clipboard

Copied

Thank you very much ! Works perfect.

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 Beginner ,
Nov 22, 2018 Nov 22, 2018

Copy link to clipboard

Copied

Hey,

I discovered that it doesn't save as a small file size. If my .ai file is 4000kb, my _LR.pdf is 4000kb too.

Normaly it hould be 4000kb and 240kb or something.

The rest of it works perfect!

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
Valorous Hero ,
Nov 22, 2018 Nov 22, 2018

Copy link to clipboard

Copied

Hmm, I'll see if I can come back to it soon.

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 Beginner ,
Jan 02, 2019 Jan 02, 2019

Copy link to clipboard

Copied

LATEST

Hey,

did you gt any chance to check the code ? It would be a huuuuuuuuge lifehack for me

I do this process 20 or more times a day ..

Thanks in advance for yor help!

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