Tk Library Source Code

View Ticket
Login
Ticket UUID: 1482926
Title: Add /eval to tkchat to be able to try out one-liners
Type: RFE Version: None
Submitter: zoro2 Created on: 2006-05-06 08:34:14
Subsystem: apps : tkchat Assigned To: patthoyts
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2006-09-14 20:16:52
Resolution: Closed By: patthoyts
    Closed on: 2006-09-14 13:16:52
Description:
I have tkchat run most of the time and sometimes I just 
want to test 1 liners like regexp/lsearch switches/
string is ... and so on. I then tend to run tkcon, but 
I guess it would be easier to just check in tkchat.

A simple implementation is as follows (could be 
expanded to distinct break/continue/return/error):

proc ::tkchat::checkCommand { msg } {
    switch -re -- $msg {
      (...)
{^/eval\s} {
    set evalCode [catch [string range $msg 6 end] 
evalResult]
    switch -- $evalCode {
0 {
    if {![string equal $evalResult ""]} {
tkchat::addMessage .txt "" "" 
"Result:\t$evalResult" ACTION end [clock seconds]
    }
}
default {
    tkchat::addMessage .txt "" "" "Error 
($evalCode):\t$evalResult" ACTION end [clock seconds]
}
    }
}
User Comments: patthoyts added on 2006-09-14 20:16:52:
Logged In: YES 
user_id=202636

Added.