good job
but i think is better to put "read" to the ID 8
and like napa's said about money index u can replace if u want the edit ID 1 and ID 3 by a combo "drop" and add in init /didtok c 1,3 46 USD AUD CAD ... THB ZAR then no errors
about %z is unless and dont complicate the task you can get the result from title like this
on *:sockread:c:{
var %tmp | sockread %tmp
if $left(%tmp,7) == <title> {
tokenize 58 %tmp
did -ra c 8 $left($3,-8)
sockclose c
unset %x
}
}
e.g: the value of 1 USD EUR return 1.00 USD = 0.745740 EUR
the code can be like this if something help u as u like
alias currency dialog $iif($dialog(c),-v,-m c) c
dialog c {
size -1 -1 100 55
option dbu
combo 1, 3 10 26 20, drop
combo 3, 30 10 26 20, drop
text From:, 2, 6 2 25 8
text To:, 4, 34 2 25 8
button Convert, 5, 3 22 90 12
edit , 6, 60 10 32 10, autohs
text Amount:, 7, 60 2 25 8
text , 8, 2 36 96 40, center
}
on *:dialog:c:*:*:{
if ($devent == init) didtok c 1,3 32 USD AUD CAD CHF CNY DKK EUR GBP HKD HUF INR JPY MXN MYR NOK NZD RUB SEK SGD THB ZAR
elseif $devent == sclick && $did == 5 {
if ($sock(c)) sockclose c
sockopen c www.xe.com 80
sockmark c $did(1) $did(3) $did(6) www.xe.com
}
}
on *:sockopen:c:{
tokenize 32 $sock(c).mark
sockwrite -n c GET $+(/ucc/convert.cgi?Amount=,$3,&From=,$1,&To=,$2) HTTP/1.1
sockwrite -n c Host: $4
sockwrite -n c $crlf
}
on *:sockread:c:{
var %tmp | sockread %tmp
if $left(%tmp,7) == <title> {
tokenize 58 %tmp
did -ra c 8 $left($3,-8)
sockclose c
unset %x
}
}
use /currency to open dialog