Skip to main content
Participating Frequently
March 12, 2009
Question

JS TextColumnCount not working.

  • March 12, 2009
  • 4 replies
  • 467 views
I have a simple JS to create a new 6 column document, however I cannot get 'TextColumnCount' to work. Can anyone see where I'm going wrong here?
Thanks

var myDocument = app.documents.add();
with(myDocument.documentPreferences){
pageHeight = "297mm";
pageWidth = "210mm";
pageOrientation = PageOrientation.portrait;
facingPages = false;
}
with(myDocument.textDefaults){
kerningMethod = "Metrics";
appliedFont = "Arial";
}
with(myDocument.pages.item(0)){
with(marginPreferences){
columnCount = 6;
columnGutter = "4.233mm";
bottom = "12.7mm";
left = "12.7mm";
right = "12.7mm";
top = "12.7mm";
}
with(textFrames.add()){
geometricBounds = ["12.7mm", "12.7mm", "284.3mm", "197.3mm"];
contents = "This is some text";
with(TextFramePreference){
TextColumnCount = 6;
}
}
}
This topic has been closed for replies.

4 replies

Participating Frequently
March 12, 2009
Kasyan

Thanks - yes that works, not sure why mine didn't though, perhaps there is something in the formatting.

thanks again.
Kasyan Servetsky
Legend
March 12, 2009
Malcolm,

I changed these two lines and it works for me. I'm posting the whole script.

Kasyan

var myDocument = app.documents.add();

with(myDocument.documentPreferences){
pageHeight = "297mm";
pageWidth = "210mm";
pageOrientation = PageOrientation.portrait;
facingPages = false;
}
with(myDocument.textDefaults){
kerningMethod = "Metrics";
appliedFont = "Arial";
}
with(myDocument.pages.item(0)){
with(marginPreferences){
columnCount = 6;
columnGutter = "4.233mm";
bottom = "12.7mm";
left = "12.7mm";
right = "12.7mm";
top = "12.7mm";
}
with(textFrames.add()){
geometricBounds = ["12.7mm", "12.7mm", "284.3mm", "197.3mm"];
contents = "This is some text";
with(textFramePreferences){
textColumnCount = 6;
}
}
}
Participating Frequently
March 12, 2009
Kasyan

I don't think that's correct, it doesn't run. The debugger comes back with "textFramePreferences undefined".
Kasyan Servetsky
Legend
March 12, 2009
with(textFramePreferences){
textColumnCount = 6;