Hello wise ones,
I am just begining to learn about applescript but have no teacher besides Google (which is great but it's hard to know where to start!).
How do I specify where I want the scripting to begin?
I'm working in Indd cs5.5 and wish to start with the first line of the first paragraph in the first text frame on the first page of the active document.
Also, I need to apply a style (that I have already set up in Indd) to this first line. Any ideas?
Any help, much appreciated!
app.activeDocument.pages.textFrames.paragraphs.appliedParagraphStyle = app.activeDocument.paragraphStyles.item("style name");
Note that there is no point in applying a paragraph style to a line; applying it to the first line will apply it to the whole first paragraph. Also: you'll have to define what you mean by the "first text frame"; the first textFrame in the page's textFrames collection—what we get from pages.textFrames—is actually the last frame that was created. If you want, say, the top-leftmost frame, you have to go through a bit more. And, this will only work if the paragraph style you're trying to apply isn't in a group.
The Applescript would be something like:
tell application "Adobe InDesign CS5.5" set the applied paragraph style of the first paragraph of the first text frame of the first page of the active document to paragraph style "style name" of the active document end tell
tell application "Adobe InDesign CS5.5"
set the applied paragraph style of the first paragraph of the first text frame of the first page of the active document to paragraph style "style name" of the active document
But I don't really know Applescript. Hope this helps.
Europe, Middle East and Africa