Article View: adobe.scripting.indesign
Article #1661Re: Script Poster
From: Harbs
Date: Mon, 02 Feb 2009 14:26
Date: Mon, 02 Feb 2009 14:26
63 lines
1694 bytes
1694 bytes
Here's another one which was posted on one of the other scripting forums (I don't remeber if it was Illustrator or Photoshop).
I changed it a bit because the original didn't work on my (Mac) computer. This one should work on both mac and Windows, and will work run under any program which supports ExtendScript (including the ESTK).
var asciiFile = new File(File.openDialog("Open File to convert","Javascript:*.jsx;"));
var tempFolder = Folder.temp;
OutHTM = new File(tempFolder.fsName + "/Code2HTM.txt");
asciiFile.open("r");
OutHTM.open("w");
var FileString = asciiFile.read();
asciiFile.close();
OutHTM.writeln("<PRE><BR>");
for (a=0;a<FileString.length;a++){
c=FileString[a];
Write(c);
}
OutHTM.writeln("</PRE>");
OutHTM.close();
OutHTM.execute();
function Write(Char){
switch (Char){
case '\n' : OutHTM.write("\n<BR>");
break;
case '\t' : OutHTM.write(" ");
break;
case '<' : OutHTM.write("<");
break;
case '>' : OutHTM.write(">");
break;
default : OutHTM.write(Char);
}
}
Technical Details
Message-ID:
<59b7c17d.0@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newshub.sdsu.edu!webcrossingReferences:
<59b7c17d.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,b01c2efbaa957bf8 X-Google-Attributes: gidf939a,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Harbs Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.scripting.indesign Subject: Re: Script Poster Message-ID: <59b7c17d.0@webcrossing.la2eafNXanI> Date: Mon, 2 Feb 2009 06:26:44 -0800 References: <59b7c17d.-1@webcrossing.la2eafNXanI> Lines: 38 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit