This is the new home of the egghelp.org community forum. this announcement post . Click the X in the top right-corner of this box to dismiss this message. 
Support & discussion of released scripts, and announcements of new releases.
			
		
				
			
				
								speechles 							 
						Revered One 			
		Posts:  1398 Joined:  Sat Aug 26, 2006 10:19 pmLocation:  emerald triangle, california (coastal redwoods) 
		
						
					
						 
													
							
						
									
						Post 
					 
								by speechles  Sat Jan 16, 2010 9:05 pm 
			
			
			
			
			
			shahrul wrote: Hi,
I got this problem after changing the code.
Code: Select all 
Tcl error [xepub]: syntax error in expression "[regexp {>Live rates at (.*?)</span>} $html match xetime] \ ...": extra tokens at end of expression
This was caused by me trying to split the code for easy viewing on the forum. I corrected that mistake in the code given 2 post above.
 
		 
				
		
		 
	 
				
		
				
			
				
								shahrul 							 
						Voice 			
		Posts:  27 Joined:  Sun Mar 06, 2005 8:52 am 
		
						
					
						 
													
							
						
									
						Post 
					 
								by shahrul  Thu Jan 21, 2010 11:13 pm 
			
			
			
			
			
			hi speechles,
the code still error.
Code: Select all 
Tcl error [xepub]: bad switch "--nocase": must be -all, -about, -indices, -inline, -expanded, -line, -linestop, -lineanchor, -nocase, -start, or --
can u fix again and upload the new file?
 
		 
				
		
		 
	 
				
		
				
			
				
								speechles 							 
						Revered One 			
		Posts:  1398 Joined:  Sat Aug 26, 2006 10:19 pmLocation:  emerald triangle, california (coastal redwoods) 
		
						
					
						 
													
							
						
									
						Post 
					 
								by speechles  Fri Jan 22, 2010 6:58 am 
			
			
			
			
			
			shahrul wrote: hi speechles,
the code still error.
Code: Select all 
Tcl error [xepub]: bad switch "--nocase": must be -all, -about, -indices, -inline, -expanded, -line, -linestop, -lineanchor, -nocase, -start, or --
can u fix again and upload the new file?
Wow.. Third time is the charm I guess. Seems not only did I screw up splitting the line for easy forum viewing I also added an extra hypen to --nocase.. This is because webby requires double hypens and since I used it as an example this carried over into the static regular expression created. Proof I'm human, we make mistakes. The below _should_ fix all the prior problems and actually work this time. 
Change this part:
Code: Select all 
	if {[regexp {>Live rates at (.*?)</span>} $html match xetime] \
	&& [regexp {<td width="45%" align="right" class="XEenlarge"><h2 class="XE">(.*?)</h2></td>} $html match fromamount] \
	&& [regexp {<td width="45%" align="left" class="XEenlarge"><h2 class="XE">(.*?)</h2></td>} $html match toamount]} {
		regsub -all {<!.*?>} $fromamount {} fromamount
		regsub -all {<!.*?>} $toamount {} toamount
		puthelp "PRIVMSG $chan :XE.COM: \002$fromamount\002 equals \002$toamount\002 as of $xetime"
	} else {
		puthelp "PRIVMSG $chan :Could not obtain results from XE.com, sorry!"
	}
To this:
Code: Select all 
	if {[regexp {>Live rates at (.*?)</span>} $html match xetime] && [regexp -nocase {<title>.*?rate\:\s+(.*?)\s+=\s+(.*?)</title>} $html match fromamount toamount]} {
		puthelp "PRIVMSG $chan :XE.COM: \002$fromamount\002 equals \002$toamount\002 as of $xetime"
	} else {
		puthelp "PRIVMSG $chan :Could not obtain results from XE.com, sorry!"
	} 
		 
				
		
		 
	 
				
		
				
			
				
								shahrul 							 
						Voice 			
		Posts:  27 Joined:  Sun Mar 06, 2005 8:52 am 
		
						
					
						 
													
							
						
									
						Post 
					 
								by shahrul  Wed Jan 27, 2010 8:28 am 
			
			
			
			
			
			speechles wrote: shahrul wrote: hi speechles,
the code still error.
Code: Select all 
Tcl error [xepub]: bad switch "--nocase": must be -all, -about, -indices, -inline, -expanded, -line, -linestop, -lineanchor, -nocase, -start, or --
can u fix again and upload the new file?
Wow.. Third time is the charm I guess. Seems not only did I screw up splitting the line for easy forum viewing I also added an extra hypen to --nocase.. This is because webby requires double hypens and since I used it as an example this carried over into the static regular expression created. Proof I'm human, we make mistakes. The below _should_ fix all the prior problems and actually work this time. 
Change this part:
Code: Select all 
	if {[regexp {>Live rates at (.*?)</span>} $html match xetime] \
	&& [regexp {<td width="45%" align="right" class="XEenlarge"><h2 class="XE">(.*?)</h2></td>} $html match fromamount] \
	&& [regexp {<td width="45%" align="left" class="XEenlarge"><h2 class="XE">(.*?)</h2></td>} $html match toamount]} {
		regsub -all {<!.*?>} $fromamount {} fromamount
		regsub -all {<!.*?>} $toamount {} toamount
		puthelp "PRIVMSG $chan :XE.COM: \002$fromamount\002 equals \002$toamount\002 as of $xetime"
	} else {
		puthelp "PRIVMSG $chan :Could not obtain results from XE.com, sorry!"
	}
To this:
Code: Select all 
	if {[regexp {>Live rates at (.*?)</span>} $html match xetime] && [regexp -nocase {<title>.*?rate\:\s+(.*?)\s+=\s+(.*?)</title>} $html match fromamount toamount]} {
		puthelp "PRIVMSG $chan :XE.COM: \002$fromamount\002 equals \002$toamount\002 as of $xetime"
	} else {
		puthelp "PRIVMSG $chan :Could not obtain results from XE.com, sorry!"
	}speechles , the code you give is working this time.. thanks you very much 
 
 
		 
				
		
		 
	 
				
		
				
			
				
								Bonnie 							 
						Voice 			
		Posts:  23 Joined:  Thu Dec 09, 2004 11:20 am 
		
						
					
						 
													
							
						
									
						Post 
					 
								by Bonnie  Fri Jan 29, 2010 8:59 am 
			
			
			
			
			
			Hi All
			
			
									
						
										
						 
		 
				
		
		 
	 
				
		
				
			
				
								Bonnie 							 
						Voice 			
		Posts:  23 Joined:  Thu Dec 09, 2004 11:20 am 
		
						
					
						 
													
							
						
									
						Post 
					 
								by Bonnie  Wed Feb 03, 2010 9:15 am 
			
			
			
			
			
			Sorry 
			
			
									
						
										
						 
		 
				
		
		 
	 
				
				
		
				
			
				
								Torrevado 							 
						Op 			
		Posts:  101 Joined:  Wed Aug 02, 2006 6:29 pm 
		
						
					
						 
													
							
						
									
						Post 
					 
								by Torrevado  Sun Feb 28, 2010 7:33 am 
			
			
			
			
			
			Nice work again, hm2k  
Now we have a weather, worldtime and currency converter which are unlikely to stop working like other http scripts.
About this ucc.tcl, could I change "$info(date)" output format? 
Thanks.
 
		 
				
		
		 
	 
				
		
				
			
				
								shahrul 							 
						Voice 			
		Posts:  27 Joined:  Sun Mar 06, 2005 8:52 am 
		
						
					
						 
													
							
						
									
						Post 
					 
								by shahrul  Sun Feb 28, 2010 4:27 pm 
			
			
			
			
			
			Hi,
			
			
									
						
										
						 
		 
				
		
		 
	 
				
		
				
			
				
								hm2k 							 
						Halfop 			
		Posts:  57 Joined:  Mon Sep 11, 2006 7:27 amLocation:  UK 
		
						
					
						 
													
							
						
									
						Post 
					 
								by hm2k  Sun Feb 28, 2010 4:42 pm 
			
			
			
			
			
			shahrul wrote: Hi,
It doesn't work unless you make changes, further more it may be subject to changes again later, which means it may stop working again.
Try this instead: 
http://hm2k.googlecode.com/svn/trunk/code/tcl/ucc.tcl 
It's not subject to these changes as it uses an API instead.
Torrevado wrote: About this ucc.tcl, could I change "$info(date)" output format? 
added $ucc(dateformat) into ucc.tcl v0.1.1, hope this helps!
 
		 
				
		
		 
	 
				
		
				
			
				
								Torrevado 							 
						Op 			
		Posts:  101 Joined:  Wed Aug 02, 2006 6:29 pm 
		
						
					
						 
													
							
						
									
						Post 
					 
								by Torrevado  Tue Mar 02, 2010 6:00 am 
			
			
			
			
			
			hm2k wrote: added $ucc(dateformat) into ucc.tcl v0.1.1, hope this helps!
It did, thank you very much.
 
		 
				
		
		 
	 
				
				
		
				
			
				
								shahrul 							 
						Voice 			
		Posts:  27 Joined:  Sun Mar 06, 2005 8:52 am 
		
						
					
						 
													
							
						
									
						Post 
					 
								by shahrul  Tue Aug 17, 2010 2:09 pm 
			
			
			
			
			
			speechless,
			
			
									
						
										
						 
		 
				
		
		 
	 
				
				
		
				
			
				
								speechles 							 
						Revered One 			
		Posts:  1398 Joined:  Sat Aug 26, 2006 10:19 pmLocation:  emerald triangle, california (coastal redwoods) 
		
						
					
						 
													
							
						
									
						Post 
					 
								by speechles  Tue Aug 17, 2010 5:22 pm 
			
			
			
			
			
			
Not to um.. burst your bubble.. but, I think he meant the fixes I gave to update rosc2112's (this is her topic after all not ucc's) aging and breakable xe.com script.
http://forum.egghelp.org/viewtopic.php?t=12653&start=32 
@sharul, This fix no longer cuts it, their html obviously has changed. Check back in a few hours and I'll have an updated regexp template collection to fix the parsing.