This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

XE.com currency convertor script v0.02b

Support & discussion of released scripts, and announcements of new releases.
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

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.
s
shahrul
Voice
Posts: 27
Joined: Sun Mar 06, 2005 8:52 am

Post by shahrul »

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?
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

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!"
	}
s
shahrul
Voice
Posts: 27
Joined: Sun Mar 06, 2005 8:52 am

Post by shahrul »

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
:)
B
Bonnie
Voice
Posts: 23
Joined: Thu Dec 09, 2004 11:20 am

Post by Bonnie »

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
B
Bonnie
Voice
Posts: 23
Joined: Thu Dec 09, 2004 11:20 am

Post by Bonnie »

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
User avatar
hm2k
Halfop
Posts: 57
Joined: Mon Sep 11, 2006 7:27 am
Location: UK

Post by hm2k »

I discovered today that this script has stopped working.

I decided the time had come to move away from XE.com and consequently this script...

Here's what I've done instead:

http://www.hm2k.com/posts/universal-cur ... or-eggdrop
T
Torrevado
Op
Posts: 101
Joined: Wed Aug 02, 2006 6:29 pm

Post by Torrevado »

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.
s
shahrul
Voice
Posts: 27
Joined: Sun Mar 06, 2005 8:52 am

Post by shahrul »

Hi,

i just tested the bot and this script is work fine.

just change a bit code on above post.

thanks
User avatar
hm2k
Halfop
Posts: 57
Joined: Mon Sep 11, 2006 7:27 am
Location: UK

Post by hm2k »

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!
T
Torrevado
Op
Posts: 101
Joined: Wed Aug 02, 2006 6:29 pm

Post by Torrevado »

hm2k wrote:added $ucc(dateformat) into ucc.tcl v0.1.1, hope this helps!
It did, thank you very much.
User avatar
hm2k
Halfop
Posts: 57
Joined: Mon Sep 11, 2006 7:27 am
Location: UK

Post by hm2k »

Hi folks,

I recommend you upgrade to latest...

http://hm2k.googlecode.com/svn/trunk/code/tcl/ucc.tcl

Thanks.
s
shahrul
Voice
Posts: 27
Joined: Sun Mar 06, 2005 8:52 am

Post by shahrul »

speechless,

can you upgrade this scripts? seem error right now.

thanks
User avatar
hm2k
Halfop
Posts: 57
Joined: Mon Sep 11, 2006 7:27 am
Location: UK

Post by hm2k »

speechless didn't write the ucc.tcl, I did.

The bug was fixed, get:

http://hm2k.googlecode.com/svn/trunk/code/tcl/ucc.tcl
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

hm2k wrote:speechless didn't write the ucc.tcl, I did.

The bug was fixed, get:

http://hm2k.googlecode.com/svn/trunk/code/tcl/ucc.tcl
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.
Post Reply