| View previous topic :: View next topic |
| Author |
Message |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Sat Jan 16, 2010 9:05 pm Post subject: |
|
|
| shahrul wrote: | Hi,
I got this problem after changing the code.
| Code: | | 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. _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
shahrul Voice
Joined: 06 Mar 2005 Posts: 27
|
Posted: Thu Jan 21, 2010 11:13 pm Post subject: |
|
|
hi speechles,
the code still error.
| Code: | | 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? |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Fri Jan 22, 2010 6:58 am Post subject: |
|
|
| shahrul wrote: | hi speechles,
the code still error.
| Code: | | 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: | 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: | 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' eggdrop tcl archive |
|
| Back to top |
|
 |
shahrul Voice
Joined: 06 Mar 2005 Posts: 27
|
Posted: Wed Jan 27, 2010 8:28 am Post subject: |
|
|
| speechles wrote: | | shahrul wrote: | hi speechles,
the code still error.
| Code: | | 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: | 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: | 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
 |
|
| Back to top |
|
 |
Bonnie Voice
Joined: 09 Dec 2004 Posts: 23
|
Posted: Fri Jan 29, 2010 8:59 am Post subject: |
|
|
Hi All
I have been getting this error for some time.
"Could not obtain results from XE.com, sorry! "
I suspect it is my script.
What is the latest update.
Any ideas?
Thanks for all the good work here
Bonnie |
|
| Back to top |
|
 |
Bonnie Voice
Joined: 09 Dec 2004 Posts: 23
|
Posted: Wed Feb 03, 2010 9:15 am Post subject: |
|
|
Sorry
I feel a bit dumb. I re-read the earlier posts. Then changed the bits of code. It works just fine.
Sorry again for being dumb.
Bonnie |
|
| Back to top |
|
 |
hm2k Halfop

Joined: 11 Sep 2006 Posts: 57 Location: UK
|
|
| Back to top |
|
 |
Torrevado Op
Joined: 02 Aug 2006 Posts: 101
|
Posted: Sun Feb 28, 2010 7:33 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
shahrul Voice
Joined: 06 Mar 2005 Posts: 27
|
Posted: Sun Feb 28, 2010 4:27 pm Post subject: |
|
|
Hi,
i just tested the bot and this script is work fine.
just change a bit code on above post.
thanks |
|
| Back to top |
|
 |
hm2k Halfop

Joined: 11 Sep 2006 Posts: 57 Location: UK
|
Posted: Sun Feb 28, 2010 4:42 pm Post subject: |
|
|
| shahrul wrote: | Hi,
i just tested the bot and this script is work fine.
just change a bit code on above post.
thanks |
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! |
|
| Back to top |
|
 |
Torrevado Op
Joined: 02 Aug 2006 Posts: 101
|
Posted: Tue Mar 02, 2010 6:00 am Post subject: |
|
|
| hm2k wrote: | | added $ucc(dateformat) into ucc.tcl v0.1.1, hope this helps! |
It did, thank you very much. |
|
| Back to top |
|
 |
hm2k Halfop

Joined: 11 Sep 2006 Posts: 57 Location: UK
|
|
| Back to top |
|
 |
shahrul Voice
Joined: 06 Mar 2005 Posts: 27
|
Posted: Tue Aug 17, 2010 2:09 pm Post subject: |
|
|
speechless,
can you upgrade this scripts? seem error right now.
thanks |
|
| Back to top |
|
 |
hm2k Halfop

Joined: 11 Sep 2006 Posts: 57 Location: UK
|
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Tue Aug 17, 2010 5:22 pm Post subject: |
|
|
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. _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
|