An motd in tcl for Windows XP

I bought an external disk from Amazon for my main home machine, which runs windows and have been moving various user's 'My Documents' folders onto the disk. It has a separate power supply and switch so its quite easy to start the computer and forget the disk, so I have written a program to check and remind people. I have written it in tcl/tk, my main documentation is on my snipsnap, but its a jolly short program, quick to write and easy to install.

  1. Install active state's toolkit.
  2. drop the icons into $tk_library/images, in this case info & warning.gif, I havn't tested if this verison of tcl/tk supports .jpg or .png yet.
  3. write the program, I create a file on the E:\\ folder and test for its existence
  4. copy it to somewhere on the boot disk
  5. create a shortcut in c:\\Documents and Settings\\All Users\\Start Menu\\Programs\\Startup

The program looks like this,

wm title . {Disk Check}
wm iconname . {diskcheck}
wm geometry . 225x65+500+100
#
# Need some version control data and also like to make it bigger
#
frame .top
frame .bottom
if {[ file isfile "E:\\donot.remove" ]} {
     set messagetext " The external disk has been turned on! "
     set buttontext " OK "
     image create photo infopic -file [file join $tk_library images info.gif]
} else {
     set messagetext " Please turn on the external disk! "
     set buttontext " Done "
     image create photo infopic -file [file join $tk_library images warning.gif]
}
label .top.icon -image infopic
frame .top.f -width 50
label .top.f.mess -text $messagetext

pack .top.f.mess -side top -fill x
pack .top.icon .top.f -side left

button .bottom.dismiss -text $buttontext -command "exit"

pack .bottom.dismiss
pack .top .bottom
proc exit {} {
     destroy .
}

The program is available as a download here.

tags:

Comments:

Post a Comment:
Comments are closed for this entry.
About

DaveLevy

Search

Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today