Notebook App - User Code Snippets

Useful code for your user code pages:

Redirect link to a page with a title different from the label on the link:

 proc --> {label target} {
    return "\[%$label|showpage [list $target]%\]"


 [@--> "This is quite a large link label" "Short Page Name"@]

WHD: This feature is built-in as of V2.1.0. See the V2.1.0 release notes [L1 ].

GC 20 September 2003 :

Create magic buttons to visit a internet site (Ex: Windows with Internet Explorer) Constitution of a links library

 # Create a button
 proc URL-> {name} {
     return "\[%$name |goToInternet $name%\]"

 # Go to internet : Display user agent with the selected url
 proc goToInternet {name} {
     set prg "C:/Program Files/Internet Explorer/IEXPLORE.EXE"
     exec $prg $name &

Usage :

 [@ URL-> @]
 [@ URL->" @]

GC 04 October 2003

A better solution :

 # Create a button
 proc -> {name} {
     return "\[%$name |goToExecution $name%\]"

 proc goToExecution {args} {
     set prg ""
     set extension [file extension $args]

     switch -regexp $extension {
         ".doc"   { set prg "C:/Program Files/Microsoft Office/Office/WINWORD.EXE"}
         ".htm*"  { set prg "C:/Program Files/Plus!/Microsoft Internet/IEXPLORE.EXE"}
         ".pdf"   { set prg "C:/Program Files/Adobe/Acrobat 5.0/Reader/AcroRd32.exe"}
         ".tcl"   { set prg "C:Program Files/UltraEdit/UEDIT32.EXE"}
         default  {return}
     exec $prg "$args" &

Usage in a page of my Notebook for edit or view something :

 [@ -> @]
 [@ ->" @]
 [@ -> C:/Tcl_Applis/prog.tcl" @]


Btw, if using the user code from , also add: "" { set prg "C:/windows/explorer.exe"} so you can also open folders! Hey this is from Lawrence, [email protected] tcl/tk really rocks!

Grant Davis - July 19, 2004

Files, web pages, and applications can be launched much more easily in Windows with the start.exe command. See my example of proc start in .