Useful code for your user code pages:
'''NOTE:''' Notebook User Code contributions should now be saved at the Notebook Wiki, http://notebook.wjduquette.com.
----
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"@]
[WHD]: This feature is built-in as of V2.1.0. See the V2.1.0 release notes [http://notebook.wjduquette.com/index.php?title=Notebook_V2.1.0].
----
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://wiki.tcl.tk @]
[@ URL-> http://wiki.tcl.tk/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://wiki.tcl.tk @]
[@ -> http://wiki.tcl.tk/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 - 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 http://tcl.projectforum.com/notebook/52.
----'''NOTE:''' Notebook User Code contributions should now be saved at the Notebook Wiki, http://notebook.wjduquette.com.
<<categories>> Discussion