TextSweep

Check-in [43a2209afc]
Login

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

Overview
Comment:Add user help
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:43a2209afceb3139468bb804508d440643fc6408
User & Date: kevin 2019-12-30 02:58:00
Context
2019-12-30
13:24
Tweak user help check-in: 998f25a02e user: kevin tags: trunk
02:58
Add user help check-in: 43a2209afc user: kevin tags: trunk
2019-12-29
03:07
Tweak to software update check-in: 5bba2b342a user: kevin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to TextSweep User Help.docx.

cannot compute difference between binary files

Added TextSweep User Help.help/Contents/Info.plist.

































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>BuildMachineOSBuild</key>
	<string>18D42</string>
	<key>CFBundleDevelopmentRegion</key>
	<string>en-us</string>
	<key>CFBundleIdentifier</key>
	<string>com.codebykevin.test-help</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundlePackageType</key>
	<string>BNDL</string>
	<key>CFBundleShortVersionString</key>
	<string>1.0</string>
	<key>CFBundleSignature</key>
	<string>hbwr</string>
	<key>CFBundleSupportedPlatforms</key>
	<array>
		<string>MacOSX</string>
	</array>
	<key>CFBundleVersion</key>
	<string>1</string>
	<key>HPDBookAccessPath</key>
	<string>TextSweep User Help.html</string>
	<key>HPDBookTitle</key>
	<string>TextSweep User Help</string>
	<key>HPDBookType</key>
	<string>3</string>
</dict>
</plist>

Added TextSweep User Help.mht.

more than 10,000 changes

Changes to buildapp.

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
..
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100


101
102
103
104
105
106
107
...
110
111
112
113
114
115
116






117
118
119
120
121
122
123
<plist version="1.0">
<dict>
	<key>CFBundleDevelopmentRegion</key>
	<string>English</string>
	<key>CFBundleExecutable</key>
	<string>TextSweep</string>
	<key>CFBundleGetInfoString</key>
	<string>TextSweep $1 (c) 2019 WordTech Communications LLC</string>
        <key>NSPrincipalClass</key>
        <string>NSApplication</string>
<key>NSHighResolutionCapable</key>
	<true/>
	<key>NSAppleScriptEnabled</key>
	<true/>
	<key>LSMinimumSystemVersionByArchitecture</key>
................................................................................
	<dict>
	<key>x86_64</key>
	<string>10.15</string>
	</dict>
	<key>LSArchitecturePriority</key>
<array>
<string>x86_64</string>
<string>i386</string>
</array>
	<key>LSApplicationCategoryType</key>
	<string>public.app-category.utilities</string>
	<key>NSHumanReadableCopyright</key>
	<string>(c) 2018 WordTech Communications LLC</string>
	<key>CFBundleIconFile</key>
	<string>textsweep.icns</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleDocumentTypes</key>
	<array>
		<dict>
................................................................................
	<key>CFBundlePackageType</key>
	<string>APPL</string>
	<key>CFBundleShortVersionString</key>
	<string>$1</string>
	<key>CFBundleVersion</key>
	<string>$1</string>
	<key>LSMinimumSystemVersion</key>
	<string>10.13</string>
	<key>LSRequiresCarbon</key>
	<true/>	
	<key>NSSupportsAutomaticTermination</key>
	<string>YES</string>
	<key>NSSupportsSuddenTermination</key>
	<string>YES</string>
  <key>SUFeedURL</key>
	<string>http://www.codebykevin.com/textsweep.xml</string>


</dict>
</plist>
EOT



#create app bundle shell from standalone Wish app
................................................................................
mv TextSweep.app/Contents/MacOS/Wish TextSweep.app/Contents/MacOS/TextSweep

#copy additional files, resources to app bundle

cp -f textsweep.icns TextSweep.app/Contents/Resources/textsweep.icns
mkdir TextSweep.app/Contents/lib
cp -R -f Scripts TextSweep.app/Contents/Resources/Scripts








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







|







 







<




|







 







|






|
|
>
>







 







>
>
>
>
>
>







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
..
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
...
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<plist version="1.0">
<dict>
	<key>CFBundleDevelopmentRegion</key>
	<string>English</string>
	<key>CFBundleExecutable</key>
	<string>TextSweep</string>
	<key>CFBundleGetInfoString</key>
	<string>TextSweep $1 (c) 2020 WordTech Communications LLC</string>
        <key>NSPrincipalClass</key>
        <string>NSApplication</string>
<key>NSHighResolutionCapable</key>
	<true/>
	<key>NSAppleScriptEnabled</key>
	<true/>
	<key>LSMinimumSystemVersionByArchitecture</key>
................................................................................
	<dict>
	<key>x86_64</key>
	<string>10.15</string>
	</dict>
	<key>LSArchitecturePriority</key>
<array>
<string>x86_64</string>

</array>
	<key>LSApplicationCategoryType</key>
	<string>public.app-category.utilities</string>
	<key>NSHumanReadableCopyright</key>
	<string>(c) 2020 WordTech Communications LLC</string>
	<key>CFBundleIconFile</key>
	<string>textsweep.icns</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleDocumentTypes</key>
	<array>
		<dict>
................................................................................
	<key>CFBundlePackageType</key>
	<string>APPL</string>
	<key>CFBundleShortVersionString</key>
	<string>$1</string>
	<key>CFBundleVersion</key>
	<string>$1</string>
	<key>LSMinimumSystemVersion</key>
	<string>10.15</string>
	<key>LSRequiresCarbon</key>
	<true/>	
	<key>NSSupportsAutomaticTermination</key>
	<string>YES</string>
	<key>NSSupportsSuddenTermination</key>
	<string>YES</string>
<key>CFBundleHelpBookFolder</key>
	<string>TextSweep User Help.help</string>
	<key>CFBundleHelpBookName</key>
	<string>TextSweep User Help</string>
</dict>
</plist>
EOT



#create app bundle shell from standalone Wish app
................................................................................
mv TextSweep.app/Contents/MacOS/Wish TextSweep.app/Contents/MacOS/TextSweep

#copy additional files, resources to app bundle

cp -f textsweep.icns TextSweep.app/Contents/Resources/textsweep.icns
mkdir TextSweep.app/Contents/lib
cp -R -f Scripts TextSweep.app/Contents/Resources/Scripts

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


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


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

Changes to scriptlibs/textsweep/textsweep-main.tcl.

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
..
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
..
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
..
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
...
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171




172
173
174
175
176
177
178
...
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
...
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
...
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
...
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
...
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
image create photo noArrow -height 14 -width 14


if {[tk windowingsystem] eq "aqua"} {
    package require cocoaprint
    package require darkaqua
    darkaqua::checkDarkMode
   }

if {[tk windowingsystem] eq "win32"} {
    package require dde
    dde servername TextSweep
}


................................................................................
	tk_messageBox -icon warning -title "Error" -message $args
    }
}

#make images for buttons et. al from files
proc makeImage {} {

  #create the images
    set imagedir [file join [file dirname [info script]] images]
    
    set imagefiles [glob -directory $imagedir *.tcl]
    foreach item $imagefiles {
	source $item
    }

................................................................................
}



#mac-only commands
if {[tk windowingsystem] eq "aqua"} {

  proc ::tk::mac::OpenDocument {fname} {
	selectFileSystem $fname
    }

    #raise window if closed--dock click
    proc ::tk::mac::ReopenApplication {} {
	if { [wm state .] == "withdrawn"} {
	    wm state . normal
................................................................................
	    wm deiconify .
	    raise .
	}
    }



#handle program shutdown via command-q
proc  ::tk::mac::Quit {} {
    regproc::makePitch
}

}

#"about application" command
proc tkAboutDialog {} {
    aboutWindow
}

proc aboutWindow {} {

    tk_messageBox -parent . -icon info -title "About TextSweep" -message "TextSweep: Search and Replace Tool" -detail "Version 5.0\n(c) 2019 WordTech Communications LLC"

}

#check file list to ensure existence
proc checkfilelist {} {

    global filelist
................................................................................

    wm title . "TextSweep"
    
    if {[tk windowingsystem] ne "aqua"} {
	wm iconphoto . -default icon-update
    }
    
  #  . configure -height 800 -width 900
    
    set patternvar *


    if {[tk windowingsystem] eq "aqua"} {
	bind . <[xplat::controlkey]-W> {wm state .  withdrawn}
	bind . <[xplat::controlkey]-w> {wm state .  withdrawn}
	wm protocol . WM_DELETE_WINDOW {wm withdraw .} 
    }






    global runsearch 
    global folder_documents 
    global edit_undo

    
................................................................................
	menu .mb.window
	.mb add cascade -label Window -menu .mb.window
    }

    
    menu .mb.help -tearoff 0
    
    if {[tk windowingsystem] ne "aqua"} {
	
	.mb.help add command -label "Help" -command machelp::userhelp
    }
    .mb.help add command -label "Contact Code by Kevin" -command machelp::usermail
    .mb.help add command -label "Web Site" -command  machelp::appweb 
    
    if {[tk windowingsystem] ne "aqua"} {
	.mb.help add command -label "About TextSweep" -command tkAboutDialog
	.mb.help add command -label "Check for Updates" -command  "softwareupdate::checkVersion $appname::name $appname::version"
................................................................................

    ttk::button .f.buttons.search -image xbm_search_32 -style Toolbutton -command batchReplace -takefocus 0
    pack .f.buttons.search  -side left  -expand no
    tooltip::tooltip .f.buttons.search  "Replace text"

    ttk::button .f.buttons.reload -image xbm_refresh_32 -style Toolbutton -command batchUndo -takefocus 0
    pack .f.buttons.reload  -side left  -expand no
   tooltip::tooltip .f.buttons.reload   "Undo replace"

    
    ttk::frame .f.foldersearch -padding 5
    pack .f.foldersearch -fill both -expand no -side top
    
    ttk::label .f.foldersearch.folder -text "Folder:"
    ttk::entry .f.foldersearch.foldervar -textvar folder
................................................................................
    pack .f.text.list.header.label -side top -fill both -expand no

    pack [ttk::separator .f.text.list.header.septop -orient vertical] -side bottom -fill both -expand no

    ttk::frame .f.text.list.box
    pack .f.text.list.box -side bottom -fill both -expand yes 
    
     #main data display
    listbox .f.text.list.box.listbox  -width 80 -yscrollcommand [list .f.text.list.box.scrollframe.scroll set] -relief flat -border 0 -takefocus 0  -activestyle none -exportselection 0

    pack  .f.text.list.box.listbox -side left -fill both -expand yes
    
    bind .f.text.list.box.listbox <<ListboxSelect>> highlightText

    tkdnd::drop_target register .f.text.list.box.listbox *
................................................................................
    bind all <[xplat::controlkey]-q> {regproc::makePitch}
    bind all <[xplat::controlkey]-Z> batchUndo
    bind all <[xplat::controlkey]-z> batchUndo
    
    focus -force .f.foldersearch.foldervar

    if {[tk windowingsystem] eq "aqua"} {
	   bind all <<LightAqua>> {darkaqua::changeImagesLight}
    bind all <<DarkAqua>> {darkaqua::changeImagesDark}
    darkaqua::checkDarkMode
   }


}

#clear text contents
proc clearText  {} {
    .f.text.frame.t configure -state normal
    .f.text.frame.t delete 1.0 end
    .f.text.frame.t configure -state disabled
}
    

#set search directory
proc setDir {} {

    global folder
    global patternvar
    global searchterm
................................................................................
    global patternvar
    global searchterm
    global searchvar
    global filelist

    set selectedfile [join [.f.text.list.box.listbox get [ .f.text.list.box.listbox curselection]]]

     .f.text.list.box.listbox delete 0 end
    clearText
    
    set filelist  [glob -type f -nocomplain -directory [join $folder] $patternvar]
    foreach item $filelist {
	if {[checkTextType $item] >= 0} {
	    .f.text.list.box.listbox insert end list $item
	}







|







 







|







 







|







 







|
|
|
|










|







 







<
<








>
>
>
>







 







|

|







 







|







 







|







 







|
|
|
|










|







 







|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
..
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
..
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
..
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
...
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
...
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
...
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
...
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
...
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
...
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
image create photo noArrow -height 14 -width 14


if {[tk windowingsystem] eq "aqua"} {
    package require cocoaprint
    package require darkaqua
    darkaqua::checkDarkMode
}

if {[tk windowingsystem] eq "win32"} {
    package require dde
    dde servername TextSweep
}


................................................................................
	tk_messageBox -icon warning -title "Error" -message $args
    }
}

#make images for buttons et. al from files
proc makeImage {} {

    #create the images
    set imagedir [file join [file dirname [info script]] images]
    
    set imagefiles [glob -directory $imagedir *.tcl]
    foreach item $imagefiles {
	source $item
    }

................................................................................
}



#mac-only commands
if {[tk windowingsystem] eq "aqua"} {

    proc ::tk::mac::OpenDocument {fname} {
	selectFileSystem $fname
    }

    #raise window if closed--dock click
    proc ::tk::mac::ReopenApplication {} {
	if { [wm state .] == "withdrawn"} {
	    wm state . normal
................................................................................
	    wm deiconify .
	    raise .
	}
    }



    #handle program shutdown via command-q
    proc  ::tk::mac::Quit {} {
	regproc::makePitch
    }

}

#"about application" command
proc tkAboutDialog {} {
    aboutWindow
}

proc aboutWindow {} {

    tk_messageBox -parent . -icon info -title "About TextSweep" -message "TextSweep: Search and Replace Tool" -detail "Version 5.0\n(c) 2020 WordTech Communications LLC"

}

#check file list to ensure existence
proc checkfilelist {} {

    global filelist
................................................................................

    wm title . "TextSweep"
    
    if {[tk windowingsystem] ne "aqua"} {
	wm iconphoto . -default icon-update
    }
    


    set patternvar *


    if {[tk windowingsystem] eq "aqua"} {
	bind . <[xplat::controlkey]-W> {wm state .  withdrawn}
	bind . <[xplat::controlkey]-w> {wm state .  withdrawn}
	wm protocol . WM_DELETE_WINDOW {wm withdraw .} 
    }

    if {[tk windowingsystem] eq "win32"} {
	wm protocol . WM_DELETE_WINDOW regproc::makePitch
    }


    global runsearch 
    global folder_documents 
    global edit_undo

    
................................................................................
	menu .mb.window
	.mb add cascade -label Window -menu .mb.window
    }

    
    menu .mb.help -tearoff 0
    
    if {[tk windowingsystem] eq "win32"} {
	
	.mb.help add command -label "Help" -command {exec hh [file join $::env(APPDATA) "TextSweep_App" "bin" "TextSweep User Help.mht"]}
    }
    .mb.help add command -label "Contact Code by Kevin" -command machelp::usermail
    .mb.help add command -label "Web Site" -command  machelp::appweb 
    
    if {[tk windowingsystem] ne "aqua"} {
	.mb.help add command -label "About TextSweep" -command tkAboutDialog
	.mb.help add command -label "Check for Updates" -command  "softwareupdate::checkVersion $appname::name $appname::version"
................................................................................

    ttk::button .f.buttons.search -image xbm_search_32 -style Toolbutton -command batchReplace -takefocus 0
    pack .f.buttons.search  -side left  -expand no
    tooltip::tooltip .f.buttons.search  "Replace text"

    ttk::button .f.buttons.reload -image xbm_refresh_32 -style Toolbutton -command batchUndo -takefocus 0
    pack .f.buttons.reload  -side left  -expand no
    tooltip::tooltip .f.buttons.reload   "Undo replace"

    
    ttk::frame .f.foldersearch -padding 5
    pack .f.foldersearch -fill both -expand no -side top
    
    ttk::label .f.foldersearch.folder -text "Folder:"
    ttk::entry .f.foldersearch.foldervar -textvar folder
................................................................................
    pack .f.text.list.header.label -side top -fill both -expand no

    pack [ttk::separator .f.text.list.header.septop -orient vertical] -side bottom -fill both -expand no

    ttk::frame .f.text.list.box
    pack .f.text.list.box -side bottom -fill both -expand yes 
    
    #main data display
    listbox .f.text.list.box.listbox  -width 80 -yscrollcommand [list .f.text.list.box.scrollframe.scroll set] -relief flat -border 0 -takefocus 0  -activestyle none -exportselection 0

    pack  .f.text.list.box.listbox -side left -fill both -expand yes
    
    bind .f.text.list.box.listbox <<ListboxSelect>> highlightText

    tkdnd::drop_target register .f.text.list.box.listbox *
................................................................................
    bind all <[xplat::controlkey]-q> {regproc::makePitch}
    bind all <[xplat::controlkey]-Z> batchUndo
    bind all <[xplat::controlkey]-z> batchUndo
    
    focus -force .f.foldersearch.foldervar

    if {[tk windowingsystem] eq "aqua"} {
	bind all <<LightAqua>> {darkaqua::changeImagesLight}
	bind all <<DarkAqua>> {darkaqua::changeImagesDark}
	darkaqua::checkDarkMode
    }


}

#clear text contents
proc clearText  {} {
    .f.text.frame.t configure -state normal
    .f.text.frame.t delete 1.0 end
    .f.text.frame.t configure -state disabled
}


#set search directory
proc setDir {} {

    global folder
    global patternvar
    global searchterm
................................................................................
    global patternvar
    global searchterm
    global searchvar
    global filelist

    set selectedfile [join [.f.text.list.box.listbox get [ .f.text.list.box.listbox curselection]]]

    .f.text.list.box.listbox delete 0 end
    clearText
    
    set filelist  [glob -type f -nocomplain -directory [join $folder] $patternvar]
    foreach item $filelist {
	if {[checkTextType $item] >= 0} {
	    .f.text.list.box.listbox insert end list $item
	}