Version 7 of Notebook App - User Code Snippets

Updated 2004-07-19 15:51:52

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]%\]"
 }

Usage:

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

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-> http://mini.net/tcl @]
 [@ URL-> http://mini.net/tcl/Notebook%20App%20-%20User%20Code%20Snippets" @]
 ...

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 :

 [@ -> http://mini.net/tcl @]
 [@ -> http://mini.net/tcl/Notebook%20App%20-%20User%20Code%20Snippets" @]
 [@ -> C:/Tcl_Applis/prog.tcl" @]

...


Btw, if using the user code from http://wiki.tcl.tk/9496 , 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 04 July 19

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 http://tcl.projectforum.com/notebook/52 .