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

Slug script

Community Beginner ,
Jul 19, 2010 Jul 19, 2010

Is there a script that can add the slug area, a text frame, and variable to any document, though. It could be run on single files or entire folders?

The only variable I require is the documents filename.

I have a very large amount of indesign docs I need PDF'd, but I need the file name on the PDF as they will be printed. And sometimes they will be printed straight from indesign. I have more and more indesign documents arriving from many sources every day too, so a scripted solution is probably better for me than trying to get people to supply them with correct slug set-up.

Thanks in advance, Tim

TOPICS
Scripting
1.9K
Translate
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 ,
Jul 19, 2010 Jul 19, 2010

In principal this is not really hard -- the good news. But I'd like to know a few more details.

How much slug would you need? Should it only be at the bottom, or all around? Where do you want the file name to appear -- on the first page only, on one or all master pages, or on every single page, or spread?

Would you like your slug text in Black, or in Registration color?

If working on a folder, would you want it to open, change, then close & save documents in the same place?

Translate
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 ,
Jul 20, 2010 Jul 20, 2010

Super.

Slug would be width of the document, whatever size that is at 10pt.

On the top only.

One every single page or spread.

In black.

Open, change, close and save in same place is fine.

Thanks for your help. Tim.

Translate
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 ,
Jul 20, 2010 Jul 20, 2010

Seems no problem. I'm at work right now, but hopefully to-nite I can find half an hour or so to look into it.

Translate
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 ,
Jul 20, 2010 Jul 20, 2010

Cheers, much appreciated.

Translate
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 ,
Jul 20, 2010 Jul 20, 2010

It's hot & stuffy here at home (above 30° -- Celsius) but I think I got the first half right. This script will add slug and a text variable to the current document, put it into a frame, and copy it around to the top left of all pages.

I have to freshen up on how to run it on multiple documents (one of the other scripters might have a good framework for that--didn't something pass by just last week? (Too hot .. can't think ..)).

//DESCRIPTION:Add File name to slug

// Jongware, 20-Jul-2010

doc = app.activeDocument;

// Add File name variable

try {

     fname = doc.textVariables.add({name:"SlugFilename", variableType:VariableTypes.FILE_NAME_TYPE});

     // Change where necessary:

     with (fname.variableOptions)

     {

          includeExtension = false;

          includePath = false;

          textBefore = "File: ";

          textAfter = "";

     }

} catch (_)

{

     fname = doc.textVariables.item("SlugFilename");

}

// Set slug at top

orgRuler = doc.viewPreferences.rulerOrigin;

doc.viewPreferences.rulerOrigin = RulerOrigin.SPINE_ORIGIN;

doc.documentPreferences.slugTopOffset = "10mm";

// Add a frame to first page

frame = doc.pages[0].textFrames.add({geometricBounds:["-9mm","2mm","-5mm","50mm"]});

frame.insertionPoints[-1].properties = {appliedFont:"Arial", fontStyle:"Bold", pointSize:8, fillColor:doc.swatches.item("Black") };

frame.texts[0].textVariableInstances.add().associatedTextVariable = fname;

// Duplicate to all pages on correct position

for (p=0; p<doc.pages.length; p++)

{

     f = frame.duplicate (doc.pages

);

     if (doc.pages

.side == PageSideOptions.LEFT_HAND)

          f.move ([-doc.documentPreferences.pageWidth, "-9mm"]);

     else if (doc.pages

.side == PageSideOptions.RIGHT_HAND)

          f.move ([0, "-9mm"]);

}

// Original may not be at correct position, so delete

frame.remove();

doc.viewPreferences.rulerOrigin = orgRuler;

Translate
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 ,
Jul 21, 2010 Jul 21, 2010

Thanks so far. I'm in Ireland, so we don't get to complain about the heat too much here!

Translate
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
Guest
Jan 04, 2017 Jan 04, 2017
LATEST

If i need to insert bottom of the page. what i have to change in the below line.

frame = doc.pages[0].textFrames.add({geometricBounds:["-9mm","2mm","-5mm","50mm"]});

Translate
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