Stringscan

Check-in [62184a51ab]
Login

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

Overview
Comment:Tweak for update on macOS
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:62184a51ab1e8c1ab66718134a764ba99e8ecc59220d0633293b2aa3d39356c7
User & Date: kevin 2017-09-26 02:19:43
Context
2018-05-17
12:39
Add new Mac icon check-in: f231eae0a5 user: kevin tags: trunk
2017-09-26
02:19
Tweak for update on macOS check-in: 62184a51ab user: kevin tags: trunk
2017-09-23
21:52
Update Windows install scripts for 1.1 check-in: 4e1a3850e5 user: kevin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to scriptlibs/softwareupdate/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 softwareupdate 1.5 [list source [file join $dir softwareupdate.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 softwareupdate_ruby 1.5 [list source [file join $dir softwareupdate.tcl]]

Changes to scriptlibs/softwareupdate/softwareupdate.tcl.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
..
96
97
98
99
100
101
102

103
104
105
106
107
108
109
...
112
113
114
115
116
117
118









119
120
121
122
123
124
125
...
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
...
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
...
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
#softwareupdate.tcl  routines to manage spoftware updates

#  Copyright (C) 2014  WordTech Communications LLC

#MIT license

package provide softwareupdate 1.5
package require http
package require tls

::http::register https 443 [list ::tls::socket -servername codebykevin.com -request 0 -require 0 -ssl2 0 -ssl3 0 -tls1 1]

namespace eval softwareupdate {

................................................................................
    #get the current installation path
    proc findCurrentInstallation {} {
	variable currentinstall
	variable appname 
	switch [tk windowingsystem] {

	    "aqua" {

		set approot [info nameofexecutable]
		set apppath [split $approot /]
		set currentinstall [join [lrange $apppath 0 [lsearch $apppath "*.app"]] / ]
	    }
	    
	    "win32" {
		set currentinstall [file join $::env(APPDATA) ${appname}_App]  
................................................................................
	    "x11" {
		return
	    }
	}
	
	return $currentinstall










    }



    #prompt user to update
    proc updatePitch {} {
	variable appname
................................................................................
    proc installUpdate {} {
	variable currentinstall
	variable status
	variable appname
	variable tmpdir

	catch {destroy .update}

	softwareupdate::findCurrentInstallation

	softwareupdate::progressDialog
	set status "Downloading update for $appname"
	
	switch [tk windowingsystem] {

	    "aqua" {
		http::geturl https://www.codebykevin.com/updates/[list $appname].dmg -channel [open $tmpdir/[list $appname].dmg w] 
		update
		after 1000
		cd $tmpdir
		set status "Attaching [list $appname].dmg"
		update
		exec hdiutil attach [list $appname].dmg
	    }
	    
	    "win32" {
		
		http::geturl https://www.codebykevin.com/updates/[list $appname]_Setup.exe -channel [open $tmpdir/[list $appname]_Setup.exe w]

	    }
................................................................................
	
	
	set status "Ready to install"
	.downloadprogress.frame.bar configure -mode determinate
	.downloadprogress.frame.bar configure -value 100
	.downloadprogress.frame.bar stop
	destroy .downloadprogress.frame.b 
	pack [ttk::button .downloadprogress.frame.b -text "Install and Relaunch" -command softwareupdate::launchUpdate] -side right -fill both -expand no
	return
    }


    #launch the update
    proc launchUpdate {}  {

................................................................................
	variable appname
	variable tmpdir
	
	switch [tk windowingsystem] {

	    "aqua" {

		file rename -force $currentinstall [file join /Users [exec whoami] .Trash [file tail $currentinstall]]

		file copy -force /Volumes/[list $appname]/[list $appname].app $currentinstall

		exec $currentinstall/Contents/MacOS/$appname &

		exec hdiutil detach /Volumes/[list $appname]

		exit
	    }
	    
	    "win32" {
		
		eval exec [auto_execok start] [file normalize $tmpdir/[list $appname]_Setup.exe] &
		exit
	    }






|







 







>







 







>
>
>
>
>
>
>
>
>







 







|
<
<












|







 







|







 







<
<
<
<
<
<
|

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
..
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
...
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
...
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
...
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
...
323
324
325
326
327
328
329






330
331
332
333
334
335
336
337
338
339
#softwareupdate.tcl  routines to manage spoftware updates

#  Copyright (C) 2014  WordTech Communications LLC

#MIT license

package provide softwareupdate_ruby 1.5
package require http
package require tls

::http::register https 443 [list ::tls::socket -servername codebykevin.com -request 0 -require 0 -ssl2 0 -ssl3 0 -tls1 1]

namespace eval softwareupdate {

................................................................................
    #get the current installation path
    proc findCurrentInstallation {} {
	variable currentinstall
	variable appname 
	switch [tk windowingsystem] {

	    "aqua" {
		set approot [file join [file dirname [info script]]]
		set approot [info nameofexecutable]
		set apppath [split $approot /]
		set currentinstall [join [lrange $apppath 0 [lsearch $apppath "*.app"]] / ]
	    }
	    
	    "win32" {
		set currentinstall [file join $::env(APPDATA) ${appname}_App]  
................................................................................
	    "x11" {
		return
	    }
	}
	
	return $currentinstall

    }

    #alternative way to get installation path
    proc setCurrentInstallation {path} {
	variable currentinstall

	set currentinstall $path
	return $currentinstall

    }



    #prompt user to update
    proc updatePitch {} {
	variable appname
................................................................................
    proc installUpdate {} {
	variable currentinstall
	variable status
	variable appname
	variable tmpdir

	catch {destroy .update}
	


	softwareupdate::progressDialog
	set status "Downloading update for $appname"
	
	switch [tk windowingsystem] {

	    "aqua" {
		http::geturl https://www.codebykevin.com/updates/[list $appname].dmg -channel [open $tmpdir/[list $appname].dmg w] 
		update
		after 1000
		cd $tmpdir
		set status "Attaching [list $appname].dmg"
		update
		exec hdiutil attach  [list $appname].dmg
	    }
	    
	    "win32" {
		
		http::geturl https://www.codebykevin.com/updates/[list $appname]_Setup.exe -channel [open $tmpdir/[list $appname]_Setup.exe w]

	    }
................................................................................
	
	
	set status "Ready to install"
	.downloadprogress.frame.bar configure -mode determinate
	.downloadprogress.frame.bar configure -value 100
	.downloadprogress.frame.bar stop
	destroy .downloadprogress.frame.b 
	pack [ttk::button .downloadprogress.frame.b -text "Install" -command softwareupdate::launchUpdate] -side right -fill both -expand no
	return
    }


    #launch the update
    proc launchUpdate {}  {

................................................................................
	variable appname
	variable tmpdir
	
	switch [tk windowingsystem] {

	    "aqua" {







		exec open -R /Volumes/[list $appname]

		 exit
	    }
	    
	    "win32" {
		
		eval exec [auto_execok start] [file normalize $tmpdir/[list $appname]_Setup.exe] &
		exit
	    }

Changes to stringscan.rb.

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
..
70
71
72
73
74
75
76

77
78
79
80
81
82
83
...
349
350
351
352
353
354
355







356
357
358
359
360
361
362
if $platform == 'aqua'
    TkPackage.require('windowlist')
    TkPackage.require('fullscreen')
    require 'tk/tk_mac'
end
TkPackage.require('regproc')
TkPackage.require('machelp')
TkPackage.require('softwareupdate')
TkPackage.require('xplat')

if $platform == 'aqua'
    $accelkey = 'Command'
else 
    $accelkey = 'Control'
end
................................................................................
                end
            })    
            Tk.ip_eval("proc ::tk::mac::OpenDocument {args} {#{setDir} $args}")
            Tk.ip_eval("proc ::tk::mac::ShowHelp {} {#{Tk.install_cmd(proc{showHelp})}}")
        end        
        drawgui
        Tk.tk_call('regproc::readLic', $appname, $appversion)

    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 = []
................................................................................
    Tk.tk_call('regproc::getReg')
end

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







#end of app class
end

#run app
app = StringscanApp.new
Tk.mainloop








|







 







>







 







>
>
>
>
>
>
>







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
..
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
...
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
if $platform == 'aqua'
    TkPackage.require('windowlist')
    TkPackage.require('fullscreen')
    require 'tk/tk_mac'
end
TkPackage.require('regproc')
TkPackage.require('machelp')
TkPackage.require('softwareupdate_ruby')
TkPackage.require('xplat')

if $platform == 'aqua'
    $accelkey = 'Command'
else 
    $accelkey = 'Control'
end
................................................................................
                end
            })    
            Tk.ip_eval("proc ::tk::mac::OpenDocument {args} {#{setDir} $args}")
            Tk.ip_eval("proc ::tk::mac::ShowHelp {} {#{Tk.install_cmd(proc{showHelp})}}")
        end        
        drawgui
        Tk.tk_call('regproc::readLic', $appname, $appversion)
        getInstall
    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 = []
................................................................................
    Tk.tk_call('regproc::getReg')
end

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


#get current installation path on macOS
def getInstall
  Tk.tk_call('softwareupdate::setCurrentInstallation',  File.dirname(File.dirname(File.dirname(__FILE__))))
end
 
#end of app class
end

#run app
app = StringscanApp.new
Tk.mainloop