🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #18969

Re: How to remove a line(AS)

#18969
From: Dave Saunders
Date: Sun, 09 Feb 2003 15:52
20 lines
1605 bytes
Yes, this can be done, although not directly. You need to use Find to gather a list of references to your delete string and then iterate through the list deleting the lines that contain the strings.

This'll do it, I think:

tell application "InDesign 2.0.2"
 set myStory to story 1 of document 1 -- or whatever
 set myString to "#delete"
 set find preferences to nothing
 set change preferences to nothing
 set myDeadLines to search in myStory for myString
 repeat with n from count of myDeadLines to 1 by -1
  try
   delete line 1 of item n of myDeadLines
  end try
 end repeat
end tell

It's important to iterate backwards through the list so that the references are not upset by the deletions. The "try" is there to deal with the possibility that your string appears twice in the same line.

Dave
Technical Details
Message-ID: <1de7c5a7.0@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!38.144.126.75.MISMATCH!feed1.newsreader.com!newsreader.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de7c5a7.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,8419cb4235aa6d89
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-02-09 08:07:50 PST
From: "Dave Saunders" <daves@pdsassoc.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!38.144.126.75.MISMATCH!feed1.newsreader.com!newsreader.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: How to remove a line(AS)
Message-ID: <1de7c5a7.0@WebX.la2eafNXanI>
Date: Sun, 9 Feb 2003 07:52:38 -0800
References: <1de7c5a7.-1@WebX.la2eafNXanI>
Lines: 24
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit