NISUS Archives

November 2015

NISUS@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Dan Bensky <[log in to unmask]>
Reply To:
Date:
Mon, 2 Nov 2015 17:54:23 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (36 lines)
Thanks for the quick and through reply. When I said that the macro was "wrong" what I meant was that the box that shows up after you run it says that there are instances of the string in the search box in files that do not contain that string. For example, I just ran it with 22 files open looking for a specific Chinese character and it came back with "16 found(s) in" all of them, although if you run the same search in each file specifically, that character only occurs in 10 of the files and with a range of 1 to 51 matches in those. On repeated trials I have found that the number of matches in all the files ends up matching the number of matches in the front file. That is, if the file in front [the file that would be searched if only one file was being searched] has 16 matches, then the macro will show  16 matches in all files.

For what it is worth, I believe that this odd behavior started after I upgraded NWP to 2.1.2 and also upgraded to El Capitan. I don't believe that I've done anything to the macro file itself, as I don't know anything myself about the NWP macro language. This is the macro from its own file:
### Find All in All Open Documents ###

# Type a find expression in the Find panel and run the macro.

# The Find operation will be done using options you have set in the Find panel.

Require Application Version '3.1'
$docs = Document.openDocuments
	# get document objects of all open documents and put them in $docs (array)

if ! $docs.count  # same as "if $docs.count == 0"
	Exit 'No open document, exit...'
end

$findExp = Read Find Expression
$results = "Find: $findExp\n\n"

foreach $doc in $docs  # for each document of all open documents...
	Document.setActive $doc  # make the document active
	$f = Find All $findExp, '*'  # do Find All and get the number of founds
	$windowTitle = $doc.displayName  # get the name displayed in the title bar
	$results &= "$f found(s) in $windowTitle\n"  # append a report to $results (variable)
end

Document.setActive $docs.firstValue  # make the first document active

Exit $results  # show the results in the Exit dialog box

### end of macro ###

Any and all suggestions are welcome, particularly as I depend on this macro in every day work. Thanks,
Dan

ATOM RSS1 RSS2