🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #358

Re: Save each page as PDF naming mod

#358
From: Peter Kahrel
Date: Wed, 25 Mar 2009 02:14
36 lines
2434 bytes

      Does that sound do-able?




Most things are doable, provided that your information is precise: first you say that pages may or may not have a text frame labelled "jobnumber" and that that frame may or may not have text in it (your post can be read like that anyway). Now you say that every page has a text frame labelled "jobnumber" and that that frame can be filled with either of three text strings. Or maybe all three strings? You say 

      then I should be able save each file with the names "Avocado.jpg", "Burnt
      Sienna.jpg" and "pnga-0431.jpg" respectively.




Or do you mean "save each file with the names "Avocado.jpg", "Burnt Sienna.jpg" _OR_ "pnga-0431.jpg" respectively."? The way you phrased it, it looks as if you want to save three files from a page. But your example shows that you meant "or", not "and".

But anyway, the last two lines of your example appear to make clear what you want. The attached script exports each page of the active document to JPG, using the contents of the text frame labelled "jobnumber" on that page. The script assumes that each page has such a text frame and that there is something in it, and that whatever is in it provides a legal file name. It doesn't do any error checking/catching at all.

Peter



app.jpegExportPreferences.resolution = 300; 
app.jpegExportPreferences.jpegExportRange = ExportRangeOrAllPages.exportRange;

app.activeDocument.sections.everyItem().includeSectionPrefix = false; 

path = app.activeDocument.filePath + '/'; 
p = app.activeDocument.pages.everyItem().getElements(); 
for (i = 0; i < p.length; i++) 
  { 
  jpg_name = p[i].textFrames.item ('jobnumber').contents + '.jpg'; 
  app.jpegExportPreferences.pageString = p[i].name; 
  app.activeDocument.exportFile (ExportFormat.jpg, File (path + jpg_name)); 
  }
Technical Details
Message-ID: <59b865f5.4@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!newshub.sdsu.edu!webcrossing
References: <59b865f5.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,5351a1eac154099d
X-Google-Attributes: gidf939a,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Peter Kahrel" <kahrel@kahrel.plus.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: Re: Save each page as PDF naming mod
Message-ID: <59b865f5.4@webcrossing.la2eafNXanI>
Date: Tue, 24 Mar 2009 19:14:10 -0700
References: <59b865f5.-1@webcrossing.la2eafNXanI>
Lines: 41
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit