dialog Bash { title "Bash quote parser" size -1 -1 316 104 option dbu list 1, -1 -1 318 93, size hsbar vsbar button "Random", 2, 0 92 37 12 button ">0", 3, 38 92 38 12 button "Close", 4, 114 92 37 12 button "Clear", 5, 77 92 37 12 radio "Put quote here", 6, 175 92 50 10, group radio "Message active", 7, 227 92 50 10 } alias qbash { dialog -dm bash bash set %bashparse 1 unset %bway } on *:dialog:bash:sclick:*:{ if ($did == 2) && (%bway) { $iif(%bway == msg,msg $active,did -i $dname 1 %bashparse) $+($str(-,10),Getting quote,$str(-,10)) inc %bashparse set %basheth Random sockopen basheth bash.org 80 } elseif ($did == 3) && (%bway) { $iif(%bway == msg,msg $active,did -i $dname 1 %bashparse) $+($str(-,10),Getting quote,$str(-,10)) inc %bashparse set %basheth o sockopen basheth bash.org 80 } elseif ($did == 4) { unset %basheth unset %bashparse sockclose basheth dialog -x $dname } elseif ($did == 5) { did -r $dname 1 set %bashparse 1 } elseif ($did == 6) { set %bway did } elseif ($did == 7) { set %bway msg } } on *:sockopen:basheth:{ sockwrite -nt $sockname GET $iif(%basheth == o,/?random1,/?random)) HTTP/1.1 sockwrite -nt $sockname Host: bash.org sockwrite -nt $sockname $crlf } on *:sockread:basheth:{ if ($sockerr) { $iif(%bway == msg,msg $active,did -i bash 1 %bashparse) Socket error: $sockerr unset %basheth inc %bashparse } else { var %ee sockread %ee if (*
* iswm %ee) { if (!%bashed) { set %bashed g $iif(%bway == msg,msg $active,did -i bash 1 %bashparse) $+($str(-,10),Quote number: $remove($gettok(%ee,3,32),href=",",?),$str(-,10)) inc %bashparse $iif(%bway == msg,msg $active,did -i bash 1 %bashparse) $removecs($replace($htmlfree($gettok(%ee,18-,32)),<,<,>,>,","),[X]) inc %bashparse } elseif (%bashed) { $iif(%bway == msg,msg $active,did -i bash 1 %bashparse) $+($str(-,10),Quote finished,$str(-,10)) inc %bashparse unset %basheth unset %bashed sockclose $sockname } } if (* iswm %ee) && (%bashed) && (*
* !iswm %ee) { $iif(%bway == msg,msg $active,did -i bash 1 %bashparse) $replace($htmlfree(%ee),<,<,>,>,",") inc %bashparse } } } menu * { bash:/qbash }