Many of the applications in Category Whizzlet are reapable and entertaining.Pages that it can reap successfully include:
- 3 Triangles (8409)
- 3D HIlbert Curve (8723)
- A grep-like utility (8405)
- A little A/D clock (2563)
- A Little CIDR Calculator (8909)
- A little drawing tool (11198)
- A little font chooser (3896)
- A little image viewer (4025)
- A minimal editor explained (9623)
- A Quick Demo of Enter and Leave Event Bindings (14573)
- A Simple Fan Animation (10820)
- A small font chooser (9173)
- A Toy Piano (3948, requires snack)
- A Very Simple Weather App (10507)
- Alphabet Wheel (9277)
- Analog widgets (9107)
- Animated Vertical Tabs (6253)
- another Asteroids (13601)
- Another MDI (9999)
- Arrow buttons (8554)
- Atlantis Cafe Illusion (12797)
- Azimuth Plotting (11079)
- Bitmap Editor (6298)
- BMP Dump (14741)
- Bouncing Balls (8572)
- Buffon's Needle (8407)
- Bulging Line Illusion (8340)
- Can You Read This? (13198)
- Canvas Rotation (8595)
- Car racing in Tcl (4364)
- Chart generation support (9503)
- Collapse (10287)
- Colliding balls (8573)
- Colliding Coins (8709)
- Convolutions (11503)
- Cubic Splines (8536)
- Cursor demo (13165)
- Daily Dilbert (8899)
- Dot to Dots (4365)
- Drag-N-Drop Example (416, the oldest page I know of that's reapable)
- Drawing rounded polygons (8590)
- Eliminator (9018)
- Enigma (8847)
- Falling Marbles (8825)
- Fern Fractal (10492)
- font configure (9947)
- gammaButton (15557)
- Gem Game (9052)
- Hack-O-Matic (9755)
- Harmonic color wheel (12201)
- Hilbert Curve (8348)
- Hold'Em Solitaire (14895)
- Horseracing in Tcl (3467)
- iConnect4 (8905)
- iMap: an indexed map viewer (8771, but don't forget to download the map)
- Kaleidoscope (12385)
- LemonTree (12751)
- Life in Snit (4324)
- Lights Out (12376)
- Lissajous Figures (8875)
- Mancala (4297)
- Mandelbrot (4714)
- Mandelbrot and Julia sets (9675)
- MasterMind (4363)
- Minesweeper on Tktable (8918)
- Morley's Miracle (8336)
- My House (14330)
- Named Colors (8606)
- Once In A Lifetime (11193)
- Parallel Geturl (11060)
- Particle System (3252)
- Pastel Colors (10330)
- Penney numerals (10761)
- Pig Latin (10356)
- Playing 3D (3190)
- Playing Card Images (8803)
- Playing UML (2257)
- Playing WIMP (12137)
- Polyhedron Nets (8528)
- pop3 (781, another old page that remarkably works)
- Puzzle Blocks (8887)
- Rain Storm (8835)
- Rainbow Tunnel (12222)
- Regular Polygons 2 (8612)
- Rush Hour (12376)
- Scat (8810)
- SkipList Demo (10430)
- Sliding panel (14508)
- Snitscope (9764, but add a call to demo at the end)
- spinbox menubutton (9648)
- Starfield (10100)
- Stickies (13186)
- TclSpringies : A simple mass and spring simulator (13131)
- Text Widget Example (928)
- Tic Tac Toe (12374)
- Tickmassfiler (11065)
- tkAtaxx (7666)
- TkBomb (6201, which needs edits to run in Tk8.4)
- [TkBugs] (1720)
- tkGoldberg (8607)
- TkMapper (6277)
- TkMines (7779)
- TkRose (8295)
- trains3.tcl (1359)
- Transparent Toplevel (10515)
- Tree nodes in motion (10426)
- Triangle Madness (9318)
- TriPeaks Solitaire (13092)
- tsreplace (16868)
- Universal Transverse Mercator (11109)
- vertical labels (8429)
- Video Poker (8987)
- WAV Dump (13685)
- Widget Configure (10021)
- Wiki History Diff (10335)
- wish-reaper (8179, you need to give it a different name, since it does not overwrite files)
- Word Jumble (10354)
- Word Search (12430)
- A little file searcher (3751, two program versions in one page that don't play nice together)
- Click me (8408, two program versions in one page that don't play nice together)
- cursors (1425, more than one version on the page that don't play nice together)
RS: Hm - the second time you "misreaped" a page of mine.. In the case of Click me, it's so ridiculously small, that it doesn't deserve splitting up; a little file searcher will split off A little file searcher (iPaq) ;-)escargo 16 Mar 2003 - The code for a little file searcher can be reaped, but I can't run it under Windows at least because it assumes a command line interface. - RS has a command line interface on Windows, the infamous DOS prompt ;-)
This program is certainly able to be improved, but it works for now.
#!/usr/bin/env wish # wish-reaper -- # This script replaces the command line interface of wiki-repeater.tcl # with a wish GUI. # Create a user interface to collect the necessary parameters # and control actions. # We need an entry for a number field (the page to reap). # Page 6277 provides TkMapper. # Page 4718 prvides the original wiki-reaper. # We need an entry for a filename field (to write the page to). # We need a button to tell when to do the job. # We need a button to tell when to quit. wm title . "Wish Reaper" set font {Helvetica 14} frame .reaper pack .reaper -expand 1 -fill both -side left label .reaper.banner -font $font -text "Wish Reaper" pack .reaper.banner -expand 1 -fill x -side top frame .reaper.data pack .reaper.data -expand 1 -fill both -pady 5 -side top label .reaper.data.page -anchor w -justify left -text "Page Number" grid .reaper.data.page -column 1 -row 1 -sticky w entry .reaper.data.pageno -textvariable pageno grid .reaper.data.pageno -column 2 -row 1 label .reaper.data.file -anchor w -justify left -text "Output file name" grid .reaper.data.file -column 1 -row 2 -sticky w entry .reaper.data.filename -textvariable filename grid .reaper.data.filename -column 2 -row 2 button .reaper.data.browse -text Browse... -command [list select_file filename] grid .reaper.data.browse -column 3 -row 2 button .reaper.reap -command reap_now -padx 4 -pady 4 -text Reap pack .reaper.reap -side left button .reaper.quit -command exit -padx 4 -pady 4 -text Quit pack .reaper.quit -side right foreach {pageno filename} $argv break focus .reaper.data.pageno .reaper.data.pageno icursor end if {[catch {package require Tcl 8.3}]} { tk_messageBox -icon error \ -message "Tcl version 8.3 or later is required." \ -type ok -parent .reaper exit } if {![catch { package require nstcl-html }] && ![catch { package require nstcl-http }]} { namespace import nstcl::* } else { # Catch a failure here and pop up a dialog box before exiting. # A more precise statement about which version of http is needed # would be helpful. http::cleanup needs to be provided. if {[catch {package require http}]} { tk_messageBox -icon error \ -message "Package http not found." \ -type ok -parent .reaper exit } else { catch {package require autoproxy} } proc ns_geturl {url} { set conn [http::geturl $url] set html [http::data $conn] http::cleanup $conn return $html } proc ns_striphtml {-tags_only html} { regsub -all -- {<[^>]+>} $html "" html return $html ;# corrected a typo here } proc ns_urlencode {string} { set allowed_chars {[a-zA-Z0-9]} set encoded_string "" foreach char [split $string ""] { if {[string match $allowed_chars $char]} { append encoded_string $char } else { scan $char %c ascii append encoded_string %[format %02x $ascii] } } return $encoded_string } } proc output {data} { global out # we don't want to throw an error if output channel has been closed catch { puts $out $data } } # Factoring out the postamble for clarity and ease of change. proc postamble { } { output \n output "# EOF" output \n } # Factoring out the preamble for clarity and ease of change. proc preamble {title url now updated} { output "#####" output "#" output "# \"$title\"" output "# [string map [list mini.net/tcl wiki.tcl.tk] $url]" output "#" output "# Tcl code harvested on: $now GMT" output "# Wiki page last updated: $updated" output "#" output "#####" output \n } proc reap {page} { set url http://wiki.tcl.tk/[ns_urlencode $page] set now [clock format [clock seconds] -format "%e %b %Y, %H:%M" -gmt 1] set html [ns_geturl $url] # can't imagine why these characters would be in here, but just to be safe set html [string map [list \x00 "" \x0d ""] $html] set html [string map [list {<pre class='sh_tcl'>} \x00 </pre> \x0d] $html] if {![regexp -nocase {<title>([^<]*)</title>} $html => title]} { set title "(no title!?)" } set re {Updated ([^G]+) by} if {![regexp -nocase $re $html => updated]} { set updated "???" } preamble $title $url $now $updated set html [ns_striphtml -tags_only $html] foreach chunk [regexp -inline -all {\x00[^\x0d]+\x0d} $html] { set chunk [string range $chunk 1 end-1] set chunk [string map [list """ \x22 "&" & "<" < ">" >] $chunk] foreach line [split $chunk \n] { if {[string index $line 0] == " "} { set line [string range $line 1 end] } output $line } } postamble } proc reap_now { } { global filename global out global pageno if {![string is integer -strict $pageno]} { # put up a dialog box here. tk_messageBox -icon error \ -message "An integer page number is required." \ -type ok -parent .reaper } elseif {$filename == ""} { # put up a dialog box here tk_messageBox -icon error -message "A nonempty filename is required." \ -type ok -parent .reaper } elseif {[file exists $filename]} { # put up a dialog box here tk_messageBox -icon error \ -message "File $filename is not allowed to be overwritten." \ -type ok -parent .reaper } elseif {[catch {open $filename w} out]} { # put up a dialog box here tk_messageBox -icon error \ -message "File $filename could not be opened." \ -type ok -parent .reaper } else { # everything is good. reap $pageno close $out # completion dialog. tk_messageBox -icon info -message "Reaping complete." -type ok\ -parent .reaper } } proc select_file {varName} { upvar $varName filename set filename [tk_getSaveFile -title "Save to file ..."] }
Created by escargo 16 Jan 2003And my thanks to the people who keep adding reapable applications to the wiki and then pointing to them from here. -- escargo 24 Sep 2003
escargo 12 Mar 2003 - Maybe I should create a reapable category to make it easy to find all the code that can be extracted; it would be a subset of Category Application.Luciano ES 19 July 2003 - How about this: edit all of the reapable applications' pages, adding the hidden tag <!-- reap-ready --> to all of them. Quite some work, but quite feasible too.MJL 30 May 2005 - Fixed the regexp to extract the "page last updated" value. <i>Updated on ... didn't match the HTML. I've split this into two lines to avoid exceeding 80 characters.daapp 07 Mar 2006 - I add optional support for http proxy and button to browse for file name.[ATK] 04.2011 - adapted for new wiki