Article View: adobe.scripting.indesign
Article #16481Margin notes/hanging side heads
From: Kari Puikkonen
Date: Tue, 09 Sep 2003 10:54
Date: Tue, 09 Sep 2003 10:54
93 lines
4452 bytes
4452 bytes
Dear scripters,
I�ve cooked a script that makes margin notes/hanging side heads from the chosen paragraphs.
The problem is that works quite fluently if margin notes/hanging side heads are on the left side page. So, have anybody done/know how to make one/how to fix this one to work also in the right side pages?
--Makes new inline frame
tell application "InDesign 2.0.2"
set myDocument to active document
if horizontal measurement units of view preferences of myDocument is not points or �
vertical measurement units of view preferences of myDocument is not points then
set myOldViewPreferences to properties of view preferences of myDocument
set horizontal measurement units of view preferences of myDocument to points
set vertical measurement units of view preferences of myDocument to points
set myResetUnits to true
else
set myResetUnits to false
end if
set myStory to parent story of selection
set paraStyles to name of applied paragraph style of every paragraph of myStory
repeat with n from 1 to count of paraStyles
if item n of paraStyles = "MarginNotes" then -- name of paragraph style you want to affect
set theText to text contents of paragraph n of myStory
set theFrame to parent text frame of character 1 of paragraph n of myStory
set theBounds to visible bounds of theFrame
set theNewBounds to {0, 0, 58, ((item 4 of theBounds) - (item 2 of theBounds) + 71)}
tell active spread of active window
set myNewFrame to make text frame
end tell
set visible bounds of myNewFrame to theNewBounds
set inset spacing of text frame preferences of myNewFrame to {0, 0, 0, 372}
set contents of insertion point 1 of myNewFrame to theText
set applied paragraph style of paragraph 1 of myNewFrame to paragraph style "MarginNotes" of document 1
delete characters 1 through -2 of paragraph n of myStory
set applied paragraph style of paragraph n of myStory to paragraph style "InLine" of document 1 -- name of inline paragraph style you want to affect
activate
select myNewFrame
cut
select insertion point 1 of paragraph n of myStory
paste
end if
end repeat
end tell
tell application "InDesign 2.0.2"
set paraStyle to "MarginNotes" -- name of paragraph style you want to affect
set theStories to object reference of stories of document 1
repeat with theStory in theStories
try
set theParaStyles to name of applied paragraph style of object reference of paragraphs of theStory
repeat with x from 1 to count of theParaStyles
if paraStyle = contents of item x of theParaStyles then
applyRunin(x, theStory) of me
end if
end repeat
end try
end repeat
end tell
on applyRunin(paraNum, storyRef)
tell application "InDesign 2.0.2"
--Deletes extra last chracter at the end of the chosen paragraph.
repeat
set theDeleteCharacter to character -1 of paragraph paraNum of storyRef
delete character -1 of paragraph paraNum of storyRef
exit repeat
end repeat
--Makes table of the chosen paragraph.
repeat
tell characters 1 through -1 of paragraph paraNum of storyRef
set myTable to make table
end tell
tell myTable
set space before to 0
set space after to 0
set properties of column 1 to {width:64, left edge stroke weight:0, right edge stroke weight:0, bottom edge stroke weight:0, top edge stroke weight:0, right inset:"0", left inset:"0", top inset:"0", bottom inset:"0"}
end tell
exit repeat
end repeat
end tell
end applyRunin
P.S. I got a hunch that my script is anyhow overdone�
Kari
Technical Details
Message-ID:
<2ccd5677.-1@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.kabelfoon.nl!npeer.de.kpn-eurorings.net!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webxShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: f939a,e514e8aa8c4da606,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-09-09 04:08:07 PST From: "Kari Puikkonen" <kari.puikkonen@welho.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.kabelfoon.nl!npeer.de.kpn-eurorings.net!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: Margin notes/hanging side heads Message-ID: <2ccd5677.-1@webx.la2eafNXanI> Date: Tue, 9 Sep 2003 03:54:53 -0700 Lines: 111 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit