Thread View: adobe.scripting.indesign
4 messages
4 total messages
Started by Malcolm Wooden
Tue, 17 Mar 2009 14:41
Passing text to a JavaScript
Author: Malcolm Wooden
Date: Tue, 17 Mar 2009 14:41
Date: Tue, 17 Mar 2009 14:41
34 lines
1617 bytes
1617 bytes
I ave a JavaScript that builds a 6 column page but I need to add variable text to it depending on how is using it. How do I pass a variable for the text to the script. My script looks like this so far.
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 = "Text goes in here";
with(textFramePreferences){
textColumnCount = 6;
}
}
}
with(myDocument.viewPreferences){
HorizontalMeasurementUnits = 205418890;
VerticalMeasurementUnits = 205418890;
}
Re: Passing text to a JavaScript
Author: Harbs
Date: Tue, 17 Mar 2009 20:51
Date: Tue, 17 Mar 2009 20:51
7 lines
747 bytes
747 bytes
Not sure what you're asking... textFrame.parentStory.contents=myText? -- Harbs http://www.in-tools.com
Re: Passing text to a JavaScript
Author: Malcolm Wooden
Date: Wed, 18 Mar 2009 10:49
Date: Wed, 18 Mar 2009 10:49
3 lines
962 bytes
962 bytes
Sorry for not making it clearer. myText could represent an external text file containing the text the user requires in the document. If I create a Do Script, how do I represent the variable of myText in my script (var myText = ?) and how do I call the variable in the Do Script? thanks
Re: Passing text to a JavaScript
Author: Harbs
Date: Wed, 18 Mar 2009 12:28
Date: Wed, 18 Mar 2009 12:28
8 lines
874 bytes
874 bytes
You want to run your script in a doScript and pass a text reference to that? If so, you should probably read this: http://www.adobeforums.com/webx/.59b7fbaf -- Harbs http://www.in-tools.com
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads