🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #9441

JS: Reading Text out of EPS files

#9441
From: Dave_Saunders
Date: Sun, 20 Aug 2006 19:39
21 lines
1392 bytes
I have some EPS files that include some text (I know that because I can open the files with BBEdit and read the contents).

The problem I'm having is getting that text into a variable. I tried this:

function getBLfmEPS(link) { 
	var myFile = File(link.filePath); 
	myFile.encoding = "BINARY"; 
	myFile.open("r"); 
	var EPStext = myFile.read(); 
	myFile.close(); 
	var EPSheight = Number(EPStext.split("%%BoundingBox: ")[1].split("\n")[0].split(" ")[3]); 
	alert(EPSheight); 
}

and I'm not getting as far as the alert because the text is just not making it into the EPStext variable. It seems to stumble on the binary header at the front of the file.

I tried changing to open for edit and then using seek to try to get past the binary stuff, but that just gives me an empty string.

Does anyone have a way to do this?

Dave
Technical Details
Message-ID: <3bc153be.-1@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news2.volia.net!news.ecp.fr!news.stben.net!webcrossing

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,41b63fc201f6d7d5,start
X-Google-Attributes: gidf939a,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Dave_Saunders@adobeforums.com
Newsgroups: adobe.scripting.indesign
Subject: JS: Reading Text out of EPS files
Message-ID: <3bc153be.-1@webcrossing.la2eafNXanI>
Date: Sun, 20 Aug 2006 12:39:31 -0700
Lines: 23
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news2.volia.net!news.ecp.fr!news.stben.net!webcrossing