Monday, November 08, 2010 at 12:04 AM.


on visitSelection (adrcallback) {
		<<Saturday, October 14, 2000 at 10:27:07 AM by DW
			<<Created. Calls the callback for every line that's selected in the target window. You could use this to create a script that counts the words in all the selected headlines, useful if you're writing a story with a budget. (Writing for print sucks.)
	local (oldcursor = op.getcursor ());
	local (selectlist = op.getselection (), selected);
	for selected in selectlist {
		op.setcursor (selected);
		if not adrcallback^ () {
	op.setcursor (oldcursor);
	return (true)}
<<bundle //test code
	<<local (ctwords = 0)
	<<on callback ()
		<<local (suboutline = op.getsuboutline ())
		<<ctwords = ctwords + string.countwords (suboutline)
		<<return (true)
	<<visitselection (@callback)
	<<dialog.alert (ctwords)

This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.