Stringscan

Check-in [5d9fdc49ca]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:More refinements for 2.0
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:5d9fdc49ca4bab4057c45ef387273d747879f7f97f39ffcec4b907ee380cfd35
User & Date: kevin 2020-05-08 13:44:39
Context
2020-05-08
13:51
More tweaks check-in: 76d16191be user: kevin tags: trunk
13:44
More refinements for 2.0 check-in: 5d9fdc49ca user: kevin tags: trunk
2020-05-07
15:59
Updates for 2.0 check-in: b2f9f853cf user: kevin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to buildapp.

83
84
85
86
87
88
89


90
91
92
93
94
95
96
...
100
101
102
103
104
105
106
107









108
109
110
111
112
113
114
	<string>10.15</string>
	<key>LSRequiresCarbon</key>
	<true/>	
	<key>NSSupportsAutomaticTermination</key>
	<string>YES</string>
	<key>NSSupportsSuddenTermination</key>
	<string>YES</string>


	<key>OSAScriptingDefinition</key>
	<string>Wish.sdef</string>
<key>CFBundleHelpBookFolder</key>
	<string>Stringscan User Help.help</string>
	<key>CFBundleHelpBookName</key>
	<string>Stringscan User Help</string>
</dict>
................................................................................

/usr/local/ruby/bin/ruby-beautify -c 4 -s stringscan.rb > main.rb
ruby2app
cp -f tkballoonhelp.rb Stringscan.app/Contents/Resources/tkballoonhelp.rb

find Stringscan.app  -name "*.a"  -exec rm -rf {} \;
find Stringscan.app  -name "*debug"  -exec rm -rf {} \;
find Stringscan.app  -name "*.sh"  -exec rm -rf {} \; 










#copy the supporting libraries
for lib in scriptlibs/*
do
  echo "Copying $lib library..."
  cp -R -f $lib Stringscan.app/Contents/lib
done







>
>







 







|
>
>
>
>
>
>
>
>
>







83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
...
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
	<string>10.15</string>
	<key>LSRequiresCarbon</key>
	<true/>	
	<key>NSSupportsAutomaticTermination</key>
	<string>YES</string>
	<key>NSSupportsSuddenTermination</key>
	<string>YES</string>
	<key>NSAppleScriptEnabled</key>
	<true/>
	<key>OSAScriptingDefinition</key>
	<string>Wish.sdef</string>
<key>CFBundleHelpBookFolder</key>
	<string>Stringscan User Help.help</string>
	<key>CFBundleHelpBookName</key>
	<string>Stringscan User Help</string>
</dict>
................................................................................

/usr/local/ruby/bin/ruby-beautify -c 4 -s stringscan.rb > main.rb
ruby2app
cp -f tkballoonhelp.rb Stringscan.app/Contents/Resources/tkballoonhelp.rb

find Stringscan.app  -name "*.a"  -exec rm -rf {} \;
find Stringscan.app  -name "*debug"  -exec rm -rf {} \;
find Stringscan.app  -name "*.sh"  -exec rm -rf {} \;


cp -R -f "Stringscan User Help.html" "Stringscan User Help.help/Contents/Resources/Stringscan User Help.html"
cp -R -f "Stringscan User Help.fld" "Stringscan User Help.help/Contents/Resources/"


cp -R -f "Stringscan User Help.help" Stringscan.app/Contents/Resources/"Stringscan User Help.help"

cp -f Wish.sdef Stringscan.app/Contents/Resources/Wish.sdef

#copy the supporting libraries
for lib in scriptlibs/*
do
  echo "Copying $lib library..."
  cp -R -f $lib Stringscan.app/Contents/lib
done

Changes to scriptlibs/darkaqua/darkaqua.tcl.

28
29
30
31
32
33
34
35


36
37
38
39
40
41
42
	set mode [catch {exec defaults read -g AppleInterfaceStyle} msg]
	if {$msg eq "Dark"} {
	    event generate . <<DarkAqua>>
	} else {
	    event generate . <<LightAqua>>
	}
    }
    


    
    namespace export *
    
}

    #raise window if closed--dock click
    proc ::tk::mac::ReopenApplication {} {







|
>
>







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
	set mode [catch {exec defaults read -g AppleInterfaceStyle} msg]
	if {$msg eq "Dark"} {
	    event generate . <<DarkAqua>>
	} else {
	    event generate . <<LightAqua>>
	}
    }

    bind all <<LightAqua>> {changeImagesLight}
    bind all <<DarkAqua>> {changeImagesDark}
    
    namespace export *
    
}

    #raise window if closed--dock click
    proc ::tk::mac::ReopenApplication {} {

Changes to scriptlibs/regproc/pkgIndex.tcl.

4
5
6
7
8
9
10
11
# by a "package unknown" script.  It invokes the
# "package ifneeded" command to set up package-related
# information so that packages will be loaded automatically
# in response to "package require" commands.  When this
# script is sourced, the variable $dir must contain the
# full path name of this file's directory.

package ifneeded regproc 1.4 [list source [file join $dir regproc.tcl]]







|
4
5
6
7
8
9
10
11
# by a "package unknown" script.  It invokes the
# "package ifneeded" command to set up package-related
# information so that packages will be loaded automatically
# in response to "package require" commands.  When this
# script is sourced, the variable $dir must contain the
# full path name of this file's directory.

package ifneeded regproc 1.6 [list source [file join $dir regproc.tcl]]

Changes to scriptlibs/regproc/regproc.tcl.

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95

96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
...
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
#regproc.tcl  routines to register serial numbers

#Copyright 2015 WordTech Communications LLC

#MIT license

package provide regproc 1.4
package require http
package require xplat


image create photo _unlock -data  {

    R0lGODlhGAAgAIABAAAAAP///yH+GkNyZWF0ZWQgd2l0aCBHSU1QIG9uIGEgTWFj
    ACH5BAEKAAEALAAAAAAYACAAAAJRjI+gq+jO4npQWmqsBvQenzBYVE1YQH7imWbm
    ib5xA89cPcp4uPX+DwwKh7SdbWXUGF2S5VHn6oBURWrL+lBmb6UrTpucfsE14u85
    tKZ5wkMBADs=











}

image create photo _check -data {
    R0lGODlhIAAaAIABAAQHB////yH+GkNyZWF0ZWQgd2l0aCBHSU1QIG9uIGEgTWFj
    ACH5BAEKAAEALAAAAAAgABoAAAJMjI+pCeuvgIR0yVtzuFxDDnoWGIoHWZobikUV
    2zLTA89yfLNjetY7iag1Ir4VzCFMfpI6ChOYeeJeTxVTZRBie6htEOrl2sJcsmVb
    AAA7














}


namespace eval regproc {

    if {![info exists library]} {
	variable library [file dirname [info script]]
    }
    variable datadir
    variable expired
    set expired 0


    #set the 30-day clock for application/version
    proc setClock {} {
	variable datadir 
	variable appname
	variable appversion
	variable appstore

	set launchTime [clock seconds]
	set saveTime [open $datadir/$appname$appversion.dat w]
	puts $saveTime $launchTime
	close $saveTime
    }

    #read the time set
    proc readClock {} {
	variable datadir 
	variable appstatus 
	variable expstatus 
	variable appname
	variable appversion
	variable appstore
	variable expired

	set curTime [clock seconds]
	set oldTime [read [open $datadir/$appname$appversion.dat r]]
	set expDate [clock scan "30 days" -base $oldTime]
	if {$curTime < $expDate } {
	    set expired 0
	    regproc::makePitch	
	} else {
	    set expired 1
	    regproc::expiredPitch
	}
    }
    
    #check to see if a time has been set
    proc checkClock {} {
	variable datadir 
	variable appname
	variable appversion
	variable appstore
	variable expired

	if {[file exists $datadir/.$appname$appversion.rc]} {
	    
	    catch "file rename $datadir/.$appname$appversion.rc $datadir/$appname$appversion.dat"
	    regproc::readClock
	    return
	}

	if  {![file exists  $datadir/$appname$appversion.dat]} {
	    regproc::setClock 
	    regproc::readClock
	} else {
	    regproc::readClock
	}
    }

    #dialog before demo has expired

    proc makePitch {} {
	variable version 
	variable appname
	variable appstore
	variable licensetitle
	set licensetitle "Purchase $appname"

	toplevel .purchase
	regproc::makeModal .purchase
	wm title .purchase $licensetitle
	wm resizable .purchase 0 0

	wm withdraw .purchase
	wm transient .purchase .

	wm protocol .purchase WM_DELETE_WINDOW {}

	ttk::frame .purchase.top -padding 10
	pack .purchase.top -side top -fill both -expand yes
	ttk::label .purchase.top.label -text "You are currently using a demo of $appname. This version will give you the chance to try \n$appname free of charge for 30 days. Would you like to buy $appname now?" -image _unlock -compound left -anchor n 

	pack .purchase.top.label  -side top -fill x -expand yes

	ttk::frame .purchase.bottom -padding 5
	pack .purchase.bottom -side bottom -fill both -expand yes

	ttk::frame .purchase.bottom.upper
	pack .purchase.bottom.upper -side top -fill both -expand no


	ttk::frame .purchase.bottom.lower -padding 5
	pack .purchase.bottom.lower -side bottom -fill both -expand no

	ttk::button .purchase.bottom.lower.install -text "Purchase" -default active -command "xplat::launch  http://www.codebykevin.com/$appname.html; regproc::getReg; destroy .purchase"
	ttk::button .purchase.bottom.lower.cancel -text "Cancel" -command " destroy .purchase; raise ."
	pack  .purchase.bottom.lower.install .purchase.bottom.lower.cancel  -side right -fill both -expand no
	
	::tk::PlaceWindow .purchase widget .

	wm deiconify .purchase
	focus .purchase.bottom.lower.install

................................................................................
	    after idle [list after 0 wm attributes .purchase -notify 1]

	    bind all <FocusIn> [list  wm attributes . -notify 0]
	}

    }

    #dialog after demo has expired
    proc expiredPitch {} {
	variable version 
	variable appname
	variable appstore
	variable expired
	variable licensetitle

	set licensetitle "Purchase $appname"

	toplevel .expired
	regproc::makeModal .expired
	wm title .expired $licensetitle
	wm resizable .expired 0 0



	wm withdraw .expired
	wm transient .expired .

	wm protocol .expired WM_DELETE_WINDOW {}

	ttk::frame .expired.top -padding 10
	pack .expired.top -side top -fill both -expand yes
	ttk::label .expired.top.label -text "This demo of $appname is now expired. Would you like to buy $appname now?" -image _unlock -compound left -anchor n 

	pack .expired.top.label  -side top -fill x -expand yes

	ttk::frame .expired.bottom -padding 5
	pack .expired.bottom -side bottom -fill both -expand yes

	ttk::frame .expired.bottom.upper
	pack .expired.bottom.upper -side top -fill both -expand no


	ttk::frame .expired.bottom.lower -padding 5
	pack .expired.bottom.lower -side bottom -fill both -expand no

	ttk::button .expired.bottom.lower.install -text "Purchase" -default active -command "xplat::launch http://www.codebykevin.com/$appname.html; regproc::getReg; destroy .expired"
	ttk::button .expired.bottom.lower.cancel -text "Cancel" -command " destroy .expired; exit"
	pack  .expired.bottom.lower.install .expired.bottom.lower.cancel  -side right -fill both -expand no
	
	::tk::PlaceWindow .expired widget .

	wm deiconify .expired
	focus .expired.bottom.lower.install

	if {[tk windowingsystem] eq "aqua"} {
	    after idle [list after 0 wm attributes .expired -notify 1]

	    bind all <FocusIn> [list  wm attributes . -notify 0]
	}
    }

    #check for license, validate if found, set demo pitch if not found
    proc readLic {application version} {

	variable serial 
	variable datadir
	variable appname
	variable appversion
	variable appstore

	set appname $application
	set appversion $version

	set datadir [xplat::appconfig $appname]

	if {[file exists $datadir/.lic] } {
	    file rename $datadir/.lic $datadir/lic.dat
	}

	if {[file exists $datadir/lic.dat]} {
	    
	    set licnum [open $datadir/lic.dat r]
	    set serial [read $licnum]
	    close $licnum
	    return
	} else {
	    set serial "Demo"
	    regproc::checkClock
	    
	}
    }


    #write license to file
    proc setLic {} {
	variable serial
	variable serialbase
	variable datadir
	variable appname
	variable regwindow
	variable appstore
	variable expired

	if {$serial == ""} {
	    tk_messageBox -icon warning -title "Incorrect Serial Number" -message "Incorrect Serial Number" -detail "Incorrect serial number. The application will exit now." -parent .number
	    exit
	}

	set count 20000

	for {set i 1} {$i < $count} {incr i 1} {

	    lappend serialbase [string toupper $appname]-[expr $i * 5]-[expr $i/11]-[expr $i - 1]-[string toupper [string trim [string range $appname 0 1]]]
	}
	

	set output [lsearch  -inline $serialbase $serial]
	
	if {$output >= 0} {
	    cd $datadir
	    set lic [open $datadir/lic.dat w]
	    puts $lic "$serial"
	    close $lic
		grab release .number
	    tk_messageBox -icon info -title "Thank You" -message "Thank You" -detail "Thank you for registering $appname." -parent .number
	    destroy .number
	    #display window that was hidden
	    catch {wm deiconify .}

	} else {
	    if {$expired == 1} {
		grab release .number
		tk_messageBox -icon warning -title "Incorrect Serial Number" -message "Incorrect Serial Number" -detail "Incorrect serial number. The application will exit now." -parent .number
		exit
	    }
	    grab release .number
	    tk_messageBox -icon warning -title "Incorrect Serial Number" -message "Incorrect Serial Number" -detail "Incorrect serial number. Please try again." -parent .number
	    regproc::getReg
	}
    }



    #generate license numbers
    proc genList {application} {

	variable appname
	variable regwindow
	variable appstore

	set appname $application

	set count 20000

	for {set i 1} {$i < $count} {incr i 1} {

	    lappend serialbase [string toupper $appname]-[expr $i * 5]-[expr $i/11]-[expr $i - 1]-[string toupper [string trim [string range $appname 0 1]]]
	}


	if [file exists  $::env(HOME)/[list $appname]-list] {
	    file delete  $::env(HOME)/[list $appname]-list
	}

	foreach item $serialbase {
	    split $item\n
	    set keylist [open $::env(HOME)/[list $appname]-list a]
	    puts $keylist $item
	    close $keylist
	}
    }

    #dialog to input registration number from demo prompt
    proc getReg {} {


	variable serial
	variable regwindow
	variable appstore
	variable expired
	variable appname
	variable licensetitle

	set licensetitle "License" 

	catch {destroy .number}
	toplevel .number
	wm title .number $licensetitle
	regproc::makeModal .number
	wm resizable .number 0 0

	wm withdraw .number
	wm transient .number .
    

	wm protocol .number WM_DELETE_WINDOW {}

	ttk::frame .number.top -padding 10
	pack .number.top -side top -fill both -expand yes

	
	ttk::label .number.top.label -text "Please enter your serial number for $appname\nin the field below:" -image _check -compound left -anchor n -padding 10
	pack .number.top.label -side top -fill both -expand yes

	ttk::entry .number.top.entry -textvariable [namespace current]::serial
	pack .number.top.entry -side bottom -fill both -expand yes

	ttk::frame .number.bottom -padding 5
	pack .number.bottom -side bottom -fill both -expand yes

	ttk::frame .number.bottom.upper
	pack .number.bottom.upper -side top -fill both -expand no


	ttk::frame .number.bottom.lower -padding 5
	pack .number.bottom.lower -side bottom -fill both -expand no

	bind .number <Return> {grab release .number; regproc::setLic;  raise .}
	ttk::button .number.bottom.lower.install -text "Register" -default active -command {grab release .number; regproc::setLic; raise .}
	ttk::button .number.bottom.lower.cancel -text "Cancel" -command "grab release .number; regproc::exitIfExpired; destroy .number; raise ."
	pack  .number.bottom.lower.install .number.bottom.lower.cancel  -side right -fill both -expand no
	
	::tk::PlaceWindow .number widget .

	wm deiconify .number
	focus .number.bottom.lower.install
	if {[tk windowingsystem] eq "aqua"} {
	    after idle [list after 0 wm attributes .number -notify 1]
	    bind all <FocusIn>  [list  wm attributes . -notify 0]
	}
    }

    proc exitIfExpired {} {

	variable expired
	if {$expired == 1} {
	    exit
	} 

    }

    proc makeModal {w} {

	variable licensetitle
	if {[tk windowingsystem] eq "aqua" } {
	    destroy $w; toplevel $w;  tk::unsupported::MacWindowStyle style $w  modal; wm title $w $licensetitle
	}
	if {[tk windowingsystem] eq "win32"} {






|
<



|
>
|
|
|
<
>
>
>
>
>
>
>
>
>
>
>


|
<
<
<
<
>
>
>
>
>
>
>
>
>
>
>
>
>
>













<
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
>





|













|













|
|







 







<
<
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56






57




















































58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
...
102
103
104
105
106
107
108







109


































































































































































































































110
111
112
113
114
115
116
#regproc.tcl  routines to register serial numbers

#Copyright 2015 WordTech Communications LLC

#MIT license

package provide regproc 1.6

package require xplat


image create bitmap _unlock -data  {
 
#define xbm_security_closed_32_width 32
#define xbm_security_closed_32_height 32
static char xbm_security_closed_32_bits[] = {

  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xF8, 0x1F, 0x00, 
  0x00, 0xFC, 0x3F, 0x00, 0x00, 0xFC, 0x3F, 0x00, 0x00, 0x7E, 0x7E, 0x00, 
  0x00, 0x1E, 0x78, 0x00, 0x00, 0x1F, 0xF8, 0x00, 0x00, 0x1F, 0xF8, 0x00, 
  0x00, 0x0F, 0xF0, 0x00, 0x00, 0x0F, 0xF8, 0x00, 0xC0, 0xFF, 0xFF, 0x03, 
  0xC0, 0xFF, 0xFF, 0x03, 0xC0, 0xFF, 0xFF, 0x03, 0xC0, 0xFF, 0xFF, 0x03, 
  0xC0, 0xFF, 0xFF, 0x03, 0xC0, 0xFF, 0xFF, 0x03, 0xC0, 0xFF, 0xFF, 0x03, 
  0xC0, 0xFF, 0xFF, 0x03, 0xC0, 0xFF, 0xFF, 0x03, 0xC0, 0xFF, 0xFF, 0x03, 
  0xC0, 0xFF, 0xFF, 0x03, 0xC0, 0xFF, 0xFF, 0x03, 0xC0, 0xFF, 0xFF, 0x03, 
  0xC0, 0xFF, 0xFF, 0x03, 0xC0, 0xFF, 0xFF, 0x03, 0xC0, 0xFF, 0xFF, 0x03, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };
}

image create bitmap _check -data {




#define xbm_folder_sans_accept_32_width 32
#define xbm_folder_sans_accept_32_height 32
static char xbm_folder_sans_accept_32_bits[] = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0xFF, 0x03, 0x00, 0x00, 0xFF, 0x03, 0x00, 0x00, 
  0x03, 0xFF, 0xFF, 0x3F, 0x03, 0xFF, 0xFF, 0x3F, 0x03, 0xFF, 0xFF, 0xFF, 
  0x03, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0xC0, 
  0x03, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x00, 0xC0, 0x03, 0x00, 0xF0, 0xC3, 
  0x03, 0x00, 0xFC, 0xCF, 0x03, 0x00, 0x1F, 0xFF, 0x03, 0x00, 0x07, 0xF8, 
  0x03, 0x80, 0x03, 0xF0, 0x03, 0x80, 0x01, 0xE6, 0x03, 0xC0, 0x01, 0xE7, 
  0x03, 0xC0, 0x98, 0xEF, 0x03, 0xC0, 0xDC, 0xC7, 0x03, 0xC0, 0xFD, 0xC3, 
  0x03, 0xC0, 0xF8, 0xC0, 0x03, 0xC0, 0xF1, 0xE0, 0x03, 0x80, 0x61, 0xE0, 
  0x03, 0x80, 0x03, 0xF0, 0x03, 0x00, 0x07, 0xF8, 0x03, 0x00, 0x1F, 0xFE, 
  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, };
}


namespace eval regproc {

    if {![info exists library]} {
	variable library [file dirname [info script]]
    }
    variable datadir
    variable expired
    set expired 0








  




















































    #dialog to request donation
    proc makePitch {} {
	variable version 
	variable appname
	variable appstore
	variable licensetitle
	set licensetitle "Support Our Work"

	toplevel .purchase
	regproc::makeModal .purchase
	wm title .purchase $licensetitle
	wm resizable .purchase 0 0

	wm withdraw .purchase
	wm transient .purchase .

	wm protocol .purchase WM_DELETE_WINDOW {}

	ttk::frame .purchase.top -padding 10
	pack .purchase.top -side top -fill both -expand yes
	ttk::label .purchase.top.label -text "SUPPORT OUR WORK\n\nDeveloping free and open source software is not free.\nWould you support the development of this application\nwith a single or recurring donation?" -image _check -compound left -anchor n 

	pack .purchase.top.label  -side top -fill x -expand yes

	ttk::frame .purchase.bottom -padding 5
	pack .purchase.bottom -side bottom -fill both -expand yes

	ttk::frame .purchase.bottom.upper
	pack .purchase.bottom.upper -side top -fill both -expand no


	ttk::frame .purchase.bottom.lower -padding 5
	pack .purchase.bottom.lower -side bottom -fill both -expand no

	ttk::button .purchase.bottom.lower.install -text "Donate" -default active -command "xplat::launch  https://liberapay.com/codebykevin/donate; exit"
	ttk::button .purchase.bottom.lower.cancel -text "Later" -command "exit"
	pack  .purchase.bottom.lower.install .purchase.bottom.lower.cancel  -side right -fill both -expand no
	
	::tk::PlaceWindow .purchase widget .

	wm deiconify .purchase
	focus .purchase.bottom.lower.install

................................................................................
	    after idle [list after 0 wm attributes .purchase -notify 1]

	    bind all <FocusIn> [list  wm attributes . -notify 0]
	}

    }








  


































































































































































































































    proc makeModal {w} {

	variable licensetitle
	if {[tk windowingsystem] eq "aqua" } {
	    destroy $w; toplevel $w;  tk::unsupported::MacWindowStyle style $w  modal; wm title $w $licensetitle
	}
	if {[tk windowingsystem] eq "win32"} {

Deleted scriptlibs/textsweep/pkgIndex.tcl.

1
2
3

  package ifneeded textsweep 3.2 [list source [file join $dir textsweep.tcl]]

<
<
<






Deleted scriptlibs/textsweep/textsweep-main.tcl.

cannot compute difference between binary files

Deleted scriptlibs/textsweep/textsweep.tcl.

1
2
3
4
package provide textsweep 3.2

source [file join [file dirname [info script]] textsweep-main.tcl]

<
<
<
<








Changes to stringscan.rb.

23
24
25
26
27
28
29

30
31
32
33

34
35
36
37

38
39
40
41
42
43
44
45
46
47
48

49
50
51
52
53
54
55
..
91
92
93
94
95
96
97
98

99
100
101
102
103
104
105
106
107
108

109
110
111
112
113
114
115
...
145
146
147
148
149
150
151

152
153
154
155
156
157
158
...
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
...
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345



346
347
348
349
350
351
352
353
354
355

356
357
358
359
360
361
362
363
364

365
366
367
368
369
370
371
372
373
374
375
376
377

378
379
380
381
382
383
384
...
385
386
387
388
389
390
391

392
393
394
395
396
397
398
399

400
401
402
403
404

405
406
407
408
409

410
411
412
413

414
415
416

417
418
419
420
421

422
423

424
425
426
427
428
429
require 'tkextlib/tile'
require 'find'
require 'tkextlib/tkDND'
require 'fileutils'
require 'tempfile'

$platform = Tk.windowingsystem

if $platform == 'aqua'
  require 'tk/tk_mac'
  TkPackage.require('darkaqua')
end

if $platform == 'win32'
	require 'tk/winpkg'
	Tk::WinDDE.servername('Stringscan')
end

TkPackage.require('regproc')
TkPackage.require('machelp')
TkPackage.require('softwareupdate')
TkPackage.require('xplat')
TkPackage.require('notifywindow')

if $platform == 'aqua'
    $accelkey = 'Command'
else 
    $accelkey = 'Control'
end

class StringscanApp
    #here we initialize our app class
    def initialize
        $dirname = ""
        $searchterm = ""
        $appname = 'Stringscan'
        $appversion = '2.0'
................................................................................
        execute_search = Tk.install_cmd(proc{
			|*args|
				args = ""
				stringgrep
			})
				
        if $platform == 'aqua'
		  Tk.ip_eval("proc ::tk::mac::OpenDocument {args} {#{set_dir} $args}")

		end
		Tk.ip_eval("proc set_search_term {args} {#{set_search_term} $args}")
		Tk.ip_eval("proc set_search_dir {args} {#{set_dir} $args}")
        Tk.ip_eval("proc execute_search {}  {#{execute_search}}")
      
        drawgui
		if $platform == 'aqua' 
			Tk.tk_call('darkaqua::checkDarkMode')
		end  
	end

    #core method; here we search for a string in text files within a directory and  display a list of matching files in the listbox 
    def stringgrep
        $root.update
        $file_list = []
        $grep_list = []
        if $termentry.get == ""
          return
................................................................................
        $grep_list = $lbox.get(0, 'end')
        num = $grep_list.count.to_s
        $bottomlabel.configure('text' => "Found #{num} matches for \"#{$searchterm}\" in #{$dirname}")
         Tk.tk_call('notifywindow::notifywindow', "Found #{num} matches for \"#{$searchterm}\" in #{$dirname}", $notifyicon)
    rescue
      bgerror "Unable to locate any file matching the search term."		
    end

def drawgui 
    begin
        Tk.ip_eval("console hide")
    rescue
      nil
    end
    #image data
................................................................................
        $appmenu.add :separator
    end
    $searchmenu = TkMenu.new($menubar)
    $menubar.add :cascade, :menu => $searchmenu, :label => 'Search'
    $searchmenu.add :command, :label => 'Choose Directory...', 'accelerator' => "#{$accelkey}+O", :command => proc{choosedir}
    $searchmenu.add :command, :label => 'Run Search', 'accelerator' => "#{$accelkey}+R", :command => proc{stringgrep}
    if $platform == 'win32'
        $searchmenu.add :command, :label => "Exit", :command=>proc{Tk.tk_call('regproc::makePitch; exit')}, 'accelerator' => "#{$accelkey}+Q"
    end
    $helpmenu = TkSysMenu_Help.new($menubar)
    $menubar.add :cascade, :menu => $helpmenu, :label => 'Help'
    if $platform != 'aqua'
        $helpmenu.add :command, :label=>'Stringscan Help', :command=>proc{
            Tk.tk_call('machelp::userhelp')
        }
................................................................................
    $bottomframe.add($bottomrightframe)   
    $labelframe = Tk::Tile::Frame.new($root).pack('side'=>'bottom', 'fill'=>'both', 'expand' => 'no')
    $bottomlabel = Tk::Tile::Label.new($labelframe) {text "No data displayed"}.pack('side' => 'left','fill' => 'both','expand' => 'no')
    $bottomsep = Tk::Tile::Separator.new($root) { orient 'horizontal' }.pack('side'=> 'bottom', 'fill'=>'both')

    if $platform == 'win32'
            $root.protocol(:WM_DELETE_WINDOW){
      proc{Tk.tk_call('regproc::makePitch; exit')}
      }
    end
      if $platform == 'aqua'
            $root.protocol(:WM_DELETE_WINDOW){
          $root['state'] = 'withdrawn'
        }
        $root.bind("#{$accelkey}-W", $root['state'] = 'withdrawn')
        $root.bind("#{$accelkey}-w", $root['state'] = 'withdrawn')



    end
    $root.bind("#{$accelkey}-Q", proc{Tk.tk_call('regproc::makePitch; exit')})
    $root.bind("#{$accelkey}-q", proc{Tk.tk_call('regproc::makePitch; exit')})
    $root.bind("#{$accelkey}-O", proc{choosedir})
    $root.bind("#{$accelkey}-o", proc{choosedir})
    $root.bind("#{$accelkey}-R", proc{stringgrep})
    $root.bind("#{$accelkey}-r", proc{stringgrep})
    $root.update
    $root.deiconify
end

#select search directory
def choosedir
    $tbox.configure('state'=>'normal')
    $tbox.delete('1.0', 'end')
    $tbox.configure('state'=>'disabled')
    $lbox.delete(0, 'end')
    $dirname = Tk::chooseDirectory('initialdir'=>Dir.home, 'parent'=>$root)
    $direntry.value = $dirname
end

#read file for display in text widget
def highlighttext(file)
    $tbox.configure('state'=>'normal')
    $tbox.delete('1.0', 'end') 
    f = open(file, 'rb')
    while(!f.eof?)
        $tbox.insert('end', f.read(1000))
    end
    f.close
    $tbox.configure('state'=>'disabled')
    $tbox.tag_configure('search', :background=>'yellow')
    sethighlight
end

#set highlight color for search term
def sethighlight
    $tbox.configure('state'=>'normal')
    $tbox.tag_remove('search', '0.0', 'end')
    return if $searchterm == ""
    cur = '1.0'
    loop {
................................................................................
        cur, len = $tbox.search_with_length("#{$searchterm}", cur, 'end')
        break if cur == ""
        $tbox.tag_add('search', cur, "#{cur} + #{len} char")
        cur = $tbox.index("#{cur} + #{len} char")
    }
    $tbox.configure('state'=>'disabled')
end

#about window for app
def aboutWindow
    Tk::messageBox :type => 'ok',
    :message => 'Stringscan: Text Search Tool',
    :icon => 'info', :title => 'About Stringscan',
    :detail  => "Version 2.0\n(c) 2020 WordTech Communications LLC",
    :parent => $root
end

#check version of installed software
def checkUpdate 
    Tk.tk_call('softwareupdate::setIcon', $winicon)
    Tk.tk_call('softwareupdate::checkVersion', $appname, $appversion)
end

#scripting commands
def set_search_term (term)
	$searchterm=term
	return #searchterm
end

def set_search_dir (dir)
	$dirname = dir
	return $dirname
end

def execute_search
	stringgreb
end

#user help
def showHelp
    Tk.tk_call('machelp::userhelp')
end
#get current installation path on macOS

def getInstall
    return File.dirname(File.dirname(File.dirname(__FILE__)))

end
#end of app class
end
#run app
app = StringscanApp.new
Tk.mainloop







>




>




>











>







 







|
>





|
<
<
|
<
>







 







>







 







|







 







|






|
|
>
>
>
|
|
|







>









>













>







 







>








>





>





>




>

|

>




<
>
|
|
>






23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
..
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109


110

111
112
113
114
115
116
117
118
...
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
...
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
...
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
...
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436

437
438
439
440
441
442
443
444
445
446
require 'tkextlib/tile'
require 'find'
require 'tkextlib/tkDND'
require 'fileutils'
require 'tempfile'

$platform = Tk.windowingsystem

if $platform == 'aqua'
  require 'tk/tk_mac'
  TkPackage.require('darkaqua')
end

if $platform == 'win32'
	require 'tk/winpkg'
	Tk::WinDDE.servername('Stringscan')
end

TkPackage.require('regproc')
TkPackage.require('machelp')
TkPackage.require('softwareupdate')
TkPackage.require('xplat')
TkPackage.require('notifywindow')

if $platform == 'aqua'
    $accelkey = 'Command'
else 
    $accelkey = 'Control'
end

class StringscanApp
    #here we initialize our app class
    def initialize
        $dirname = ""
        $searchterm = ""
        $appname = 'Stringscan'
        $appversion = '2.0'
................................................................................
        execute_search = Tk.install_cmd(proc{
			|*args|
				args = ""
				stringgrep
			})
				
        if $platform == 'aqua'
	  Tk.ip_eval("proc ::tk::mac::OpenDocument {args} {#{set_dir} $args}")
          Tk.ip_eval("proc ::tk::mac::Quit {} {proc {shutdown}}")
		end
		Tk.ip_eval("proc set_search_term {args} {#{set_search_term} $args}")
		Tk.ip_eval("proc set_search_dir {args} {#{set_dir} $args}")
        Tk.ip_eval("proc execute_search {}  {#{execute_search}}")
      
        drawgui  


    end

    
    #core method; here we search for a string in text files within a directory and  display a list of matching files in the listbox 
    def stringgrep
        $root.update
        $file_list = []
        $grep_list = []
        if $termentry.get == ""
          return
................................................................................
        $grep_list = $lbox.get(0, 'end')
        num = $grep_list.count.to_s
        $bottomlabel.configure('text' => "Found #{num} matches for \"#{$searchterm}\" in #{$dirname}")
         Tk.tk_call('notifywindow::notifywindow', "Found #{num} matches for \"#{$searchterm}\" in #{$dirname}", $notifyicon)
    rescue
      bgerror "Unable to locate any file matching the search term."		
    end
    
def drawgui 
    begin
        Tk.ip_eval("console hide")
    rescue
      nil
    end
    #image data
................................................................................
        $appmenu.add :separator
    end
    $searchmenu = TkMenu.new($menubar)
    $menubar.add :cascade, :menu => $searchmenu, :label => 'Search'
    $searchmenu.add :command, :label => 'Choose Directory...', 'accelerator' => "#{$accelkey}+O", :command => proc{choosedir}
    $searchmenu.add :command, :label => 'Run Search', 'accelerator' => "#{$accelkey}+R", :command => proc{stringgrep}
    if $platform == 'win32'
        $searchmenu.add :command, :label => "Exit", :command=>proc{shutdown}, 'accelerator' => "#{$accelkey}+Q"
    end
    $helpmenu = TkSysMenu_Help.new($menubar)
    $menubar.add :cascade, :menu => $helpmenu, :label => 'Help'
    if $platform != 'aqua'
        $helpmenu.add :command, :label=>'Stringscan Help', :command=>proc{
            Tk.tk_call('machelp::userhelp')
        }
................................................................................
    $bottomframe.add($bottomrightframe)   
    $labelframe = Tk::Tile::Frame.new($root).pack('side'=>'bottom', 'fill'=>'both', 'expand' => 'no')
    $bottomlabel = Tk::Tile::Label.new($labelframe) {text "No data displayed"}.pack('side' => 'left','fill' => 'both','expand' => 'no')
    $bottomsep = Tk::Tile::Separator.new($root) { orient 'horizontal' }.pack('side'=> 'bottom', 'fill'=>'both')

    if $platform == 'win32'
            $root.protocol(:WM_DELETE_WINDOW){
      proc{shutdown}
      }
    end
      if $platform == 'aqua'
            $root.protocol(:WM_DELETE_WINDOW){
          $root['state'] = 'withdrawn'
        }
        $root.bind("#{$accelkey}-W", proc{$root['state'] = 'withdrawn'})
        $root.bind("#{$accelkey}-w", proc{$root['state'] = 'withdrawn'})
        $root.bind( '<LightAqua>', proc{Tk.tk_call('darkaqua::changeImagesLight')})
        $root.bind( '<DarkAqua>', proc{Tk.tk_call('darkaqua::changeImagesDark')}) 
	Tk.tk_call('darkaqua::checkDarkMode')
      end
    $root.bind("#{$accelkey}-Q", proc{shutdown})
    $root.bind("#{$accelkey}-q", proc{shutdown})
    $root.bind("#{$accelkey}-O", proc{choosedir})
    $root.bind("#{$accelkey}-o", proc{choosedir})
    $root.bind("#{$accelkey}-R", proc{stringgrep})
    $root.bind("#{$accelkey}-r", proc{stringgrep})
    $root.update
    $root.deiconify
end

#select search directory
def choosedir
    $tbox.configure('state'=>'normal')
    $tbox.delete('1.0', 'end')
    $tbox.configure('state'=>'disabled')
    $lbox.delete(0, 'end')
    $dirname = Tk::chooseDirectory('initialdir'=>Dir.home, 'parent'=>$root)
    $direntry.value = $dirname
end

#read file for display in text widget
def highlighttext(file)
    $tbox.configure('state'=>'normal')
    $tbox.delete('1.0', 'end') 
    f = open(file, 'rb')
    while(!f.eof?)
        $tbox.insert('end', f.read(1000))
    end
    f.close
    $tbox.configure('state'=>'disabled')
    $tbox.tag_configure('search', :background=>'yellow')
    sethighlight
end

#set highlight color for search term
def sethighlight
    $tbox.configure('state'=>'normal')
    $tbox.tag_remove('search', '0.0', 'end')
    return if $searchterm == ""
    cur = '1.0'
    loop {
................................................................................
        cur, len = $tbox.search_with_length("#{$searchterm}", cur, 'end')
        break if cur == ""
        $tbox.tag_add('search', cur, "#{cur} + #{len} char")
        cur = $tbox.index("#{cur} + #{len} char")
    }
    $tbox.configure('state'=>'disabled')
end

#about window for app
def aboutWindow
    Tk::messageBox :type => 'ok',
    :message => 'Stringscan: Text Search Tool',
    :icon => 'info', :title => 'About Stringscan',
    :detail  => "Version 2.0\n(c) 2020 WordTech Communications LLC",
    :parent => $root
end

#check version of installed software
def checkUpdate 
    Tk.tk_call('softwareupdate::setIcon', $winicon)
    Tk.tk_call('softwareupdate::checkVersion', $appname, $appversion)
end

#scripting commands
def set_search_term (term)
	$searchterm=term
	return #searchterm
end

def set_search_dir (dir)
	$dirname = dir
	return $dirname
end

def execute_search
	stringgrep
end

#user help
def showHelp
    Tk.tk_call('machelp::userhelp')
end


#exit
def shutdown
  Tk.tk_call('regproc::makePitch')
end
#end of app class
end
#run app
app = StringscanApp.new
Tk.mainloop