Skip to content

Instantly share code, notes, and snippets.

@Flave
Created October 5, 2012 11:03
Show Gist options
  • Save Flave/3839255 to your computer and use it in GitHub Desktop.
Save Flave/3839255 to your computer and use it in GitHub Desktop.
My Project of the auto-typo-adobe-id course at FH Potsdam....so far
/*
Once this script does something it should split up a Text at specified words, characters, scentences etc.
The resulting snipets should then be used as visual representation for the amount of text in different ways......
*/
//general, global document dimensions
var pw = 400;
var ph = 400;
var margins = {
t : 12,
r : 12,
l : 12,
b : 12
}
//get some initial text to work with
//var myText = TextFrameContents.PLACEHOLDER_TEXT;
var myTextfile = File.openDialog("Choose your File", "*.*", false);
var myText;
if (myTextfile != null) {
myTextfile.open('r');
myText = myTextfile.read();
}
//Array containing the snippets of text
var snippets = new Array();
//Array containing the words/characters the text should get splitted at
var splittingChars = ["x", "y", "z"];
//create new document and set preferences
var doc = app.documents.add({
documentPreferences: {
pageWidth : pw,
pageHeight : ph,
facingPages : false
}
});
var page = doc.pages.item(0);
/*with (page.marginPreferences){
top = margins.t;
right = margins.r;
bottom = margins.b;
left = margins.l;
}*/
page.marginPreferences.properties = {
top : margins.t,
right : margins.r,
bottom : margins.b,
left : margins.l
};
//add textFrame, filling out the whole page
var tf = page.textFrames.add({
geometricBounds : [margins.t, margins.l, ph - margins.b, pw - margins.r],
contents : myText
});
tf.lines[0].pointSize = 20;
for(var i = 0; i < myText.length; i++) {
myText.split(" ");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment