🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #17570

Re: Req. For Help: Create new text boxes from clipboard

#17570
From: Dave Saunders
Date: Thu, 29 May 2003 18:27
26 lines
2200 bytes
Here you go. You might want to modify the first three statements to better serve your purpose. If your labels are never more than 16 units wide (I have my machine set up to use Picas) then the width doesn't matter, but if you have a maximum width for a label then the fourth value in coords needs to be the width + the second value.

You also need to set the name of the paragraph style to be used for these labels so that can be set before fitting. The gap is just how far apart the labels will initially be placed on the page.

set coords to {0, 3, 63, 19}
set gap to 3
set LabelParaStyle to "Label"
set theText to the clipboard as string
set theLabels to every paragraph of theText
tell application "InDesign 2.0.2"
 repeat with n from 1 to (count theLabels) - 1
  if contents of item n of theLabels is not "" then
   set item 1 of coords to (item 1 of coords) + gap
   tell active spread of active window
    set myFrame to make text frame with properties {visible bounds:coords}
   end tell
   set contents of insertion point 1 of myFrame to item n of the theLabels
   set applied paragraph style of paragraph 1 of myFrame to paragraph style LabelParaStyle of document 1
   fit myFrame given frame to content
  end if
 end repeat
end tell

Oh, if you're wondering why I seem to be ignoring the last label, it's because when AppleScript gets the clipboard as a string it adds an extra line with a gash character in it.

Dave
Technical Details
Message-ID: <1de95236.4@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de95236.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,3ff73acf5baeb89
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-05-29 11:38:07 PST
From: "Dave Saunders" <daves@pdsassoc.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: Req. For Help: Create new text boxes from clipboard
Message-ID: <1de95236.4@WebX.la2eafNXanI>
Date: Thu, 29 May 2003 11:27:40 -0700
References: <1de95236.-1@WebX.la2eafNXanI>
Lines: 37
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit