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: 4,686
Karma: 764832
Join Date: Jan 2010
Location: France
Device: PRS-300, Galaxy Nexus, Nexus 7, HTC Sensation, Galaxy Tab 10.1
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