🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #56

Win vs. Mac File Paths

#56
From: really_randy
Date: Thu, 26 Mar 2009 21:32
25 lines
2043 bytes
I have a script that Peter Kahrel helped me with (actually he pretty much wrote the whole thing). The script saves out each page of an Indesign doc as jpeg. It also takes the text from a text box tagged "jobnumber" and inserts it into the name of the saved jpeg.
It works great on the Mac. When I move it over to Windows it inserts a weird character before and after the "jobnumber".
On the Mac I can take the folder name which is a variable called 'path' and insert that into the filename as well but it doesn't work on Windows. Does anyone know what the differences are between Mac and Win paths in JS? I tried a few things to no avail.
Here's the script:

==========================================
var path = Folder.selectDialog ("Choose a Folder")

app.jpegExportPreferences.resolution = 72;
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));
===========================================

As always, Thanks a million,

Randy
  }
Technical Details
Message-ID: <59b86bd5.-1@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!newsfeed2.telusplanet.net!newsfeed.telus.net!newshub.sdsu.edu!webcrossing

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,86376aa01d018ed4,start
X-Google-Attributes: gidf939a,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: really_randy@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!newsfeed2.telusplanet.net!newsfeed.telus.net!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: Win vs. Mac File Paths
Message-ID: <59b86bd5.-1@webcrossing.la2eafNXanI>
Date: Thu, 26 Mar 2009 14:32:35 -0700
Lines: 36
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit