🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #19024

Dealing with failed search

#19024
From: Dave Saunders
Date: Tue, 28 Jan 2003 17:02
18 lines
1315 bytes
What is the best way to detect that a search has failed to find anything?

I've been using:

set find preferences to nothing
set change preferences to nothing
repeat
 set myResult to search myStory for "^p^p" replacing with "^p"
 try
  get myResult
 on error
  exit repeat
 end try
end repeat

But I'm sometime crashing ID 2.0.2 using this technique (although I can't reproduce it in trivial documents).

The problem is that you can't test myResult because it becomes undefined if nothing is found.
Technical Details
Message-ID: <1de79630.-1@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!WebX

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,d60260131d47ee93,start
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-01-28 09:08:34 PST
From: "Dave Saunders" <daves@pdsassoc.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Dealing with failed search
Message-ID: <1de79630.-1@WebX.la2eafNXanI>
Date: Tue, 28 Jan 2003 09:02:50 -0800
Lines: 21
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit