aboutsummaryrefslogtreecommitdiff
path: root/colorgrid/base64.tcl
blob: 26ad408d8c0d3aea6bb68225ee209c90b8ccfe6e (plain)
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
 package require base64

 proc encode {} {
     .txt delete 1.0 end
     set fileID [open [tk_getOpenFile] RDONLY]
     fconfigure $fileID -translation binary
     set rawData [read $fileID]
     close $fileID
     set encodedData [base64::encode $rawData]
     .txt insert 1.0 $encodedData
 }

 proc clipcopy {} {
     clipboard clear
     clipboard append [.txt get 1.0 end]
 }

 wm title . "Base64 Gif Encoder"
 text .txt -wrap none -font "Courier 10"
 menu .mbar
 . configure -menu .mbar
 .mbar add command -label "Encode File" -command encode
 .mbar add command -label "Copy2Clipboard" -command clipcopy
 .mbar add command -label "Exit" -command {destroy .; exit}

 pack .txt -expand 1 -fill both

 encode
 ### End of Script