View Single Post
Old 01-16-2011, 04:53 AM   #12
chaley
"chaley", not "charley"
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 5,402
Karma: 821638
Join Date: Jan 2010
Location: France
Device: Many android devices
Here is a better version of the last template program. The original was throwing exceptions that didn't hurt anything but cluttered up the log. This one avoids that by ensuring that only numbers are passed to the cmp function.

Code:
program:
	comments = field('comments');
	percent = re(comments,	'(?is).*last page read: location \d+ \((\d+)%\).*', '\1');
	contains(	comments,
				'(?i).*?last page read: location', 
				cmp(switch(percent, '^\d*$', percent, 0),
					94,
					'No',
					'No',
					'Yes'),
				'Unopened')
chaley is offline   Reply With Quote