Article View: adobe.scripting.indesign
Article #20768Re: List links
From: peter long
Date: Wed, 05 Jun 2002 22:16
Date: Wed, 05 Jun 2002 22:16
43 lines
6353 bytes
6353 bytes
set startTime to (time of (current date)) tell application "InDesign 2.0.1"
-- may 5 2001 -- april 11, 2002 tell document 1 try set myPath to file path set myLinkpath to {} set myLinkType to {} set myKeyLine to {} set myKeycolour to {} set mycolourSpace to {} set myLinkPage to {} set myHortstatus to {} set myVertstatus to {}
set myDocName to name -- file name set theLinks to every link whose needed is true set loop to (count of theLinks) log theLinks
repeat with i from 1 to count of theLinks set end of myLinkpath to file path of item i of theLinks log i & " " & item i of theLinks & " " & item i of myLinkpath
set end of myKeyLine to stroke weight of object reference of parent of parent of item i of theLinks set end of myKeycolour to name of stroke color of object reference of parent of parent of item i of theLinks set end of mycolourSpace to color space of parent of item i of theLinks set end of myVertstatus to (my round_truncate(vertical scale of parent of item i of theLinks, 2))
if (my round_truncate(vertical scale of parent of item i of theLinks, 2)) - (my round_truncate(horizontal scale of parent of item i of theLinks, 2)) != 0 then set end of myHortstatus to (my round_truncate(horizontal scale of parent of item i of theLinks, 2)) else set end of myHortstatus to space end if
set myParent to parent of item i of theLinks set PageNumber to 9999
try if class of myParent is not page then repeat until class of myParent is page set myParent to parent of myParent end repeat end if set PageNumber to name of myParent end try
set end of myLinkPage to PageNumber end repeat
end try end tell set printMe to myPath & myDocName & return log i & " " & (count of theLinks) try repeat with linkcnt from 1 to (count of theLinks) --log printMe
set printMe to printMe � & item linkcnt of myLinkpath & tab � & item linkcnt of mycolourSpace & tab � & item linkcnt of myLinkPage & tab � & item linkcnt of myHortstatus & tab � & item linkcnt of myVertstatus & tab � & item linkcnt of myKeyLine & tab � & item linkcnt of myKeycolour & return end repeat end try --Create a new document and assign its --identity to the variable "myDocument" set myDocument to make document tell myDocument --Create a new text frame on the first spread. tell spread 1 to make text frame --Change the size of the text frame. set tableStyle to make paragraph style with properties {style name:"table"} set applied font of tableStyle to "Times" set font style of tableStyle to "Roman" set point size of tableStyle to 8 set leading of tableStyle to 7
tell text frame 1 of spread 1 set geometric bounds to {".25i", ".25i", "10.5i", "8i"} set contents to printMe set applied paragraph style of parent story to tableStyle set myTable to make table tell myTable tell column 7 set width to 0.5 end tell tell column 6 set width to 0.3 end tell tell column 5 set width to 0.5 end tell tell column 4 set width to 0.5 end tell tell column 3 set width to 0.3 end tell tell column 2 set width to 0.4 end tell tell column 1 set width to 5.5 end tell end tell end tell end tell end tell
on round_truncate(this_number, decimal_places) -- NOTE: his sub-routine uses the number_to_text() sub-routine if decimal_places is 0 then set this_number to this_number + 0.5 return number_to_text(this_number div 1) end if
set the rounding_value to "5" repeat decimal_places times set the rounding_value to "0" & the rounding_value end repeat set the rounding_value to ("." & the rounding_value) as number
set this_number to this_number + rounding_value
set the mod_value to "1" repeat decimal_places - 1 times set the mod_value to "0" & the mod_value end repeat set the mod_value to ("." & the mod_value) as number
set second_part to (this_number mod 1) div the mod_value if the length of (the second_part as text) is less than the � decimal_places then repeat decimal_places - � (the length of (the second_part as text)) times set second_part to ("0" & second_part) as string end repeat end if
set first_part to this_number div 1 set first_part to number_to_text(first_part) set this_number to (first_part & "." & second_part)
return this_number end round_truncate on number_to_text(this_number) set this_number to this_number as text if this_number contains "E+" then set x to the offset of "." in this_number set y to the offset of "+" in this_number set z to the offset of "E" in this_number set the decimal_adjust to characters (y - (length of this_number)) thru � -1 of this_number as string as number if x is not 0 then set the first_part to characters 1 thru (x - 1) of this_number as string else set the first_part to "" end if set the second_part to characters (x + 1) thru (z - 1) of this_number as string set the converted_number to the first_part repeat with i from 1 to the decimal_adjust try set the converted_number to � the converted_number & character i of the second_part on error set the converted_number to the converted_number & "0" end try end repeat return the converted_number else return this_number end if end number_to_text
set took to (time of (current date)) - startTime display dialog "time taken in sec: " & took
Technical Details
Message-ID:
<ef8f2e8.0@WebX.aaQKaf7vad4>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!peer.news.opaltelecom.net!iad-peer.news.verio.net!news.verio.net!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<ef8f2e8.-1@WebX.aaQKaf7vad4>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: f939a,7d91f97d2f98d6fa X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2002-06-05 15:37:50 PST From: "peter long" <kl@yt.sympatico.ca> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!peer.news.opaltelecom.net!iad-peer.news.verio.net!news.verio.net!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: List links Message-ID: <ef8f2e8.0@WebX.aaQKaf7vad4> Date: Wed, 5 Jun 2002 15:16:42 -0700 References: <ef8f2e8.-1@WebX.aaQKaf7vad4> Lines: 198 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit