#!/bin/sh
# the next line restarts using wish \
exec wish "$0" "$@"

#####################################################################
#
# File : 	invite.tcl
# 
# Purpose :	Select invitees from LION-DB
#
# Author :	Ing. Hans-Michael Haschek
#
# Copyright : 	(c) Case Software Technologies 2006, Austria
#
#####################################################################

#################################
# GLOBAL VARIABLES
#
global widget; 

#################################
# USER DEFINED PROCEDURES
#

# write changes back, if any
proc done:noninv {} {
	global NOT_INVITE N_LIST1

	set fd [open $NOT_INVITE w+]
	foreach ent $N_LIST1 {puts $fd $ent}
	close $fd
	destroy .ninv
}

proc edit:noninv {} {
	global NOT_INVITE N_LIST N_LIST1

	set base .ninv
	if {[winfo exists $base]} {
		wm deiconify $base; return
	}
	###################
	# CREATING WIDGETS
	###################
	toplevel $base -class Toplevel
	wm focusmodel $base passive
	wm geometry $base 199x286+189+154
	wm maxsize $base 1009 738
	wm minsize $base 1 1
	wm overrideredirect $base 0
	wm resizable $base 1 1
	wm deiconify $base
	wm title $base "New Toplevel 1"
	frame $base.cpd18 \
        -borderwidth 1 -relief raised -height 30 -width 30 
	listbox $base.cpd18.01 \
        -background white \
        -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
        -xscrollcommand {.ninv.cpd18.02 set} \
        -yscrollcommand {.ninv.cpd18.03 set} 
	scrollbar $base.cpd18.02 \
        -background grey77 -borderwidth 1 -command {.ninv.cpd18.01 xview} \
        -orient horizontal -width 10 
	scrollbar $base.cpd18.03 \
        -background grey77 -borderwidth 1 -command {.ninv.cpd18.01 yview} \
        -width 10 
	button $base.but19 -text Remove -command {
		set p [.ninv.cpd18.01 curselection]; if {$p == ""} return
		set na [.ninv.cpd18.01 get $p]; set N_LIST [lreplace $N_LIST $p $p]
		set N_LIST1 [lreplace $N_LIST1 $p $p]
		.ninv.cpd18.01 delete 0 end; foreach ent $N_LIST {.ninv.cpd18.01 insert end $ent}
	}
	button $base.but20 -text Done -command done:noninv
	###################
	# SETTING GEOMETRY
	###################
	place $base.cpd18 \
        -in .ninv -x 5 -y 5 -width 190 -height 245 -anchor nw \
        -bordermode ignore 
	grid columnconf $base.cpd18 0 -weight 1
	grid rowconf $base.cpd18 0 -weight 1
	grid $base.cpd18.01 \
        -in .ninv.cpd18 -column 0 -row 0 -columnspan 1 -rowspan 1 \
        -sticky nesw 
	grid $base.cpd18.02 \
        -in .ninv.cpd18 -column 0 -row 1 -columnspan 1 -rowspan 1 -sticky ew 
	grid $base.cpd18.03 \
        -in .ninv.cpd18 -column 1 -row 0 -columnspan 1 -rowspan 1 -sticky ns 
	place $base.but19 \
        -in .ninv -x 5 -y 255 -anchor nw -bordermode ignore 
	place $base.but20 \
        -in .ninv -x 130 -y 255 -width 67 -height 26 -anchor nw \
        -bordermode ignore 
	if {[file exists $NOT_INVITE] && [file size $NOT_INVITE] != 0} {
		set fd [open $NOT_INVITE RDONLY]
		while {![eof $fd]} {
			set li [gets $fd]; if {[eof $fd]} break
			lappend N_LIST1 $li
			set li [split $li ","]; regsub -all "\"" [lindex $li end] "" em
			lappend N_LIST $em
			$base.cpd18.01 insert end $em
		}
		close $fd
	} else {
		set N_LIST ""
	}
}

# skip, data is incomplete
proc do:skip {} {
	global DECIDE

	set DECIDE 1
}

proc do:inv {} {
	global DECIDE NAME EMAIL TO_INVITE

	set DECIDE 1
	set fd1 [open $TO_INVITE a+]; # to invite
	puts $fd1 "[lindex $NAME 0],[lindex $NAME end],$EMAIL"
	close $fd1
}

proc do:notinv {} {
	global DECIDE NAME EMAIL NOT_INVITE

	set DECIDE 1
	set fd0 [open $NOT_INVITE a+]; # not invite
	puts $fd0 "\"$NAME\",\"$EMAIL\""
	close $fd0
}

# start scanning db for new invitees
proc browse {} {
	global DB LI_CONTACT TO_INVITE NOT_INVITE HELPTEXT DECIDE
	global NAME EMAIL PROFILE LOC INF1 INF2 INF3 INF4 INF5 COMMENT

	if {$DB == "" || $LI_CONTACT == "" || $TO_INVITE == "" || $NOT_INVITE == ""} {
		tk_messageBox -icon error -message "Filename empty" -type ok
		return; # not valid
	}
	if {![file exists $DB]} {
		tk_messageBox -icon error -message "Database does not exist" -type ok
		return
	}
	if {![file exists $LI_CONTACT]} {
		tk_messageBox -icon error -message "Contacts-file does not exist" -type ok
		return
	}
	.top17.fra28.but41 conf -state normal
	.top17.fra28.skip conf -state normal
	.top17.fra28.but42 conf -state normal
	.top17.fra18.but27 conf -state disabled
	.top17.fra18.but22 conf -state disabled
	.top17.fra18.but24 conf -state disabled
	.top17.fra18.but26 conf -state disabled
	.top17.fra18.but20 conf -state disabled
	
	set fd1 [open $TO_INVITE w+]; # initialize file
	puts $fd1 "First Name,Last Name,Email"
	close $fd1
	# create the contact-buffer
	text .top17.buf
	set fd [open $LI_CONTACT RDONLY]
	.top17.buf insert end [read $fd]; # load contacts
	close $fd
	if {[file exists $NOT_INVITE] && [file size $NOT_INVITE] != 0} {
		set fd [open $NOT_INVITE RDONLY]
		while {![eof $fd]} {
			set li [gets $fd]; if {[eof $fd]} break
			set li [split $li ","]; regsub -all "\"" [lindex $li end] "" em
			lappend NINV $em
		}
		close $fd
	} else {
		set NINV ""
	}
	# scan LION-db
	set fd [open $DB RDONLY]; # source
	set li [gets $fd]; # skip description
	while {![eof $fd]} {
		set DECIDE 0
		set li [gets $fd]; if {[eof $fd]} break; # done
		set p1 [string first "," $li]; incr p1 -1
		regsub -all "\"" [string range $li 0 $p1] "" NAME
		incr p1 3
		set p2 [string first "," $li $p1]; incr p2 -1
		regsub -all "\"" [string range $li $p1 $p2] "" EMAIL
		incr p2 3
		update
		if {[.top17.buf search -nocase $EMAIL 1.0] != ""} {
			continue; # email found
		}
		if {[lsearch -exact $NINV $EMAIL] != -1} continue; # to skip
		# attempt to find people using a different email than in LI
		set n2 [.top17.buf search -nocase [lindex $NAME end] 1.0]
		if {$n2 != ""} {
			set np [lindex [split $n2 "."] 0]
			set n1 [.top17.buf search -nocase [lindex $NAME 0] $np.0 $np.999]
			if {$n1 != ""} continue; # name found, just diff email
		}
		set p3 [string first "," $li $p2]; incr p3 -1
		regsub -all "\"" [string range $li $p2 $p3] "" PROFILE
		incr p3 3
		set p4 [string first "," $li $p3]; incr p4 -1
		regsub -all "\"" [string range $li $p3 $p4] "" LOC
		incr p4 3
		set p5 [string first "," $li $p4]; incr p5 -1
		regsub -all "\"" [string range $li $p4 $p5] "" INF1
		incr p5 3
		set p6 [string first "," $li $p5]; incr p6 -1
		regsub -all "\"" [string range $li $p5 $p6] "" INF2
		incr p6 3
		set p7 [string first "," $li $p6]; incr p7 -1
		regsub -all "\"" [string range $li $p6 $p7] "" INF3
		incr p7 3
		set p8 [string first "," $li $p7]; incr p8 -1
		regsub -all "\"" [string range $li $p7 $p8] "" INF4
		incr p8 3
		set p9 [string first "," $li $p8]; incr p9 -1
		regsub -all "\"" [string range $li $p8 $p9] "" INF5
		incr p9 3
		set p10 [string first "," $li $p9]; incr p10 -1
		regsub -all "\"" [string range $li $p9 $p10] "" COMMENT
		tkwait variable DECIDE
	}
	close $fd
	.top17.fra28.but41 conf -state disabled
	.top17.fra28.skip conf -state disabled
	.top17.fra28.but42 conf -state disabled
}

# browse li-contacts-file
proc browse:li {} {
	global LI_CONTACT

	set types {
	{{Outlook}		{.csv}	}
	{{Text Files}		{.txt}  }
	{{All files}		*}
	}
	set f [tk_getOpenFile -defaultextension ".csv" -title "Existing connections" -filetypes $types]
	if {$f != ""} {set LI_CONTACT $f}
}

# browse LION-db
proc browse:db {} {
	global DB TO_INVITE NOT_INVITE LI_CONTACT

	set types {
	{{Text Files}		{.txt}  }
	{{All files}		*}
	}
	set f [tk_getOpenFile -defaultextension ".txt" -title "LION Database" -filetypes $types]
	if {$f != ""} {
		if {[file tail $f] != "database.txt"} {
			tk_messageBox -icon error -message "Wrong filename selected!\nShould be database.txt" -type ok
			return
		}
		set DB $f
		set path [file dirname $f]
		set TO_INVITE $path/to_invite.txt
		set NOT_INVITE $path/not_invite.txt
		set LI_CONTACT $path/linkedin_connections_export_microsoft_outlook.csv
	}
	.top17.fra18.but27 conf -state normal
	.top17.noninv conf -state normal
}

# browse for invite-output
proc browse:2inv {} {
	global TO_INVITE

	set types {
	{{Text Files}		{.txt}  }
	{{All files}		*}
	}
	set f [tk_getSaveFile -defaultextension ".txt" -title "File for invitees" \
		-initialfile $TO_INVITE -filetypes $types]
	if {$f != ""} {set OUTPUT $f}
}

# browse for not-invite-output
proc browse:0inv {} {
	global NOT_INVITE

	set types {
	{{Text Files}		{.txt}  }
	{{All files}		*}
	}
	set f [tk_getSaveFile -defaultextension ".txt" -title "File for \"not2invite\"" \
		-initialfile $NOT_INVITE -filetypes $types]
	if {$f != ""} {set OUTPUT $f}
}

proc Window {args} {
global vTcl
    set cmd [lindex $args 0]
    set name [lindex $args 1]
    set newname [lindex $args 2]
    set rest [lrange $args 3 end]
    if {$name == "" || $cmd == ""} {return}
    if {$newname == ""} {
        set newname $name
    }
    set exists [winfo exists $newname]
    switch $cmd {
        show {
            if {$exists == "1" && $name != "."} {wm deiconify $name; return}
            if {[info procs vTclWindow(pre)$name] != ""} {
                eval "vTclWindow(pre)$name $newname $rest"
            }
            if {[info procs vTclWindow$name] != ""} {
                eval "vTclWindow$name $newname $rest"
            }
            if {[info procs vTclWindow(post)$name] != ""} {
                eval "vTclWindow(post)$name $newname $rest"
            }
        }
        hide    { if $exists {wm withdraw $newname; return} }
        iconify { if $exists {wm iconify $newname; return} }
        destroy { if $exists {destroy $newname; return} }
    }
}

#################################
# VTCL GENERATED GUI PROCEDURES
#

proc vTclWindow. {base} {
	if {$base == ""} {
		set base .
	}
	###################
	# CREATING WIDGETS
	###################
	wm focusmodel $base passive
	wm geometry $base 1x1+0+0
	wm maxsize $base 1009 738
	wm minsize $base 1 1
	wm overrideredirect $base 0
	wm resizable $base 1 1
	wm withdraw $base
	wm title $base "vt.tcl"
	###################
	# SETTING GEOMETRY
	###################
}

proc vTclWindow.top17 {base} {
	global DB LI_CONTACT TO_INVITE NOT_INVITE HELPTEXT
	global NAME EMAIL PROFILE LOC INF1 INF2 INF3 INF4 INF5 COMMENT

	set base .top17

	if {[winfo exists $base]} {
		wm deiconify $base; return
	}
	###################
	# CREATING WIDGETS
	###################
	toplevel $base -class Toplevel
	wm focusmodel $base passive
	wm geometry $base 611x540+94+157
	wm maxsize $base 1009 738
	wm minsize $base 1 1
	wm overrideredirect $base 0
	wm resizable $base 1 1
	wm deiconify $base
	wm title $base "LION Invite"

	frame $base.fra18 -borderwidth 2 -relief groove -height 75 -width 125 
	frame $base.fra18.cpd19 -borderwidth 1 -relief raised -height 30 -width 30 
	label $base.fra18.cpd19.01 -anchor w -text Database -width 10 
	entry $base.fra18.cpd19.02 -background white -textvariable DB 
	button $base.fra18.but20 -text Browse -command browse:db
	frame $base.fra18.cpd21 -borderwidth 1 -relief raised -height 30 -width 30 
	label $base.fra18.cpd21.01 -anchor w -text {LI Contacts} -width 10 
	entry $base.fra18.cpd21.02 -background white -textvariable LI_CONTACT 
	button $base.fra18.but22 -text Browse -command browse:li
	frame $base.fra18.cpd23 -borderwidth 1 -relief raised -height 30 -width 30 
	label $base.fra18.cpd23.01 -anchor w -text {To Invite} -width 10 
	entry $base.fra18.cpd23.02 -background white -textvariable TO_INVITE 
	button $base.fra18.but24 -text Browse -command browse:2inv
	frame $base.fra18.cpd25 -borderwidth 1 -relief raised -height 30 -width 30 
	label $base.fra18.cpd25.01 -anchor w -text {Not Invite} -width 10 
	entry $base.fra18.cpd25.02 -background white -textvariable NOT_INVITE 
	button $base.fra18.but26 -text Browse -command browse:0inv
	button $base.fra18.but27 -text Start -command browse -state disabled
	bind $base.fra18.cpd19 <Enter> {set HELPTEXT "Database-file to load"}
	bind $base.fra18.cpd19 <Leave> {set HELPTEXT ""}
	bind $base.fra18.cpd21 <Enter> {set HELPTEXT "LI-contacts-file to load"}
	bind $base.fra18.cpd21 <Leave> {set HELPTEXT ""}
	bind $base.fra18.cpd23 <Enter> {set HELPTEXT "Name of file to store invitees"}
	bind $base.fra18.cpd23 <Leave> {set HELPTEXT ""}
	bind $base.fra18.cpd25 <Enter> {set HELPTEXT "Name of file to store non-invitees"}
	bind $base.fra18.cpd25 <Leave> {set HELPTEXT ""}
	bind $base.fra18.but20 <Enter> {set HELPTEXT "Browse for filename"}
	bind $base.fra18.but20 <Leave> {set HELPTEXT ""}
	bind $base.fra18.but22 <Enter> {set HELPTEXT "Browse for filename"}
	bind $base.fra18.but22 <Leave> {set HELPTEXT ""}
	bind $base.fra18.but24 <Enter> {set HELPTEXT "Browse for filename"}
	bind $base.fra18.but24 <Leave> {set HELPTEXT ""}
	bind $base.fra18.but26 <Enter> {set HELPTEXT "Browse for filename"}
	bind $base.fra18.but26 <Leave> {set HELPTEXT ""}

	# details
	frame $base.fra28 -borderwidth 2 -relief groove -height 75 -width 125 
	label $base.fra28.lab29 -borderwidth 1 -text Detail 
	frame $base.fra28.cpd30 -borderwidth 1 -relief raised -height 30 -width 30 
	label $base.fra28.cpd30.01 -anchor w -text Name 
	entry $base.fra28.cpd30.02 -background white -textvariable NAME
	frame $base.fra28.cpd31 -borderwidth 1 -relief raised -height 30 -width 30 
	label $base.fra28.cpd31.01 -anchor w -text Email 
	entry $base.fra28.cpd31.02 -background white -textvariable EMAIL
	frame $base.fra28.cpd32 -borderwidth 1 -relief raised -height 30 -width 30 
	label $base.fra28.cpd32.01 -anchor w -text Profile 
	entry $base.fra28.cpd32.02 -background white -textvariable PROFILE
	button $base.fra28.but33 -text Show -command "exec netscape -remote $PROFILE &" -state disabled
	frame $base.fra28.cpd34 -borderwidth 1 -relief raised -height 30 -width 30 
	label $base.fra28.cpd34.01 -anchor w -text City/Country -width 11 
	entry $base.fra28.cpd34.02 -background white -textvariable LOC 
	frame $base.fra28.cpd35 -borderwidth 1 -relief raised -height 30 -width 30 
	label $base.fra28.cpd35.01 -anchor w -text {INF 1} -width 11 
	entry $base.fra28.cpd35.02 -background white -textvariable INF1 
	frame $base.fra28.cpd36 -borderwidth 1 -relief raised -height 30 -width 30 
	label $base.fra28.cpd36.01 -anchor w -text {INF 2} -width 11 
	entry $base.fra28.cpd36.02 -background white -textvariable INF2 
	frame $base.fra28.cpd37 -borderwidth 1 -relief raised -height 30 -width 30 
	label $base.fra28.cpd37.01 -anchor w -text {INF 3} -width 11 
	entry $base.fra28.cpd37.02 -background white -textvariable INF3 
	frame $base.fra28.cpd38 -borderwidth 1 -relief raised -height 30 -width 30 
	label $base.fra28.cpd38.01 -anchor w -text {INF 4} -width 11 
	entry $base.fra28.cpd38.02 -background white -textvariable INF4 
	frame $base.fra28.cpd39 -borderwidth 1 -relief raised -height 30 -width 30 
	label $base.fra28.cpd39.01 -anchor w -text {INF 5} -width 11 
	entry $base.fra28.cpd39.02 -background white -textvariable INF5 
	frame $base.fra28.cpd40 -borderwidth 1 -relief raised -height 30 -width 30 
	label $base.fra28.cpd40.01 -anchor w -text Comment -width 11 
	entry $base.fra28.cpd40.02 -background white -textvariable COMMENT 
	button $base.fra28.but41 -text {Not Invite} -command do:notinv -state disabled
	button $base.fra28.skip -text Skip -command do:skip -state disabled
	button $base.fra28.but42 -text {To Invite} -command do:inv -state disabled
	bind $base.fra28.but41 <Enter> {set HELPTEXT "Add to not-invite-list"}
	bind $base.fra28.but41 <Leave> {set HELPTEXT ""}
	bind $base.fra28.skip <Enter> {set HELPTEXT "Skip entry"}
	bind $base.fra28.skip <Leave> {set HELPTEXT ""}
	bind $base.fra28.but42 <Enter> {set HELPTEXT "Add to invite-list"}
	bind $base.fra28.but42 <Leave> {set HELPTEXT ""}
	label $base.lab43 -borderwidth 1 -textvariable HELPTEXT
	button $base.noninv -text "Edit non-invitees" -command edit:noninv -state disabled
	button $base.but44 -text Done -command {destroy .}
	###################
	# SETTING GEOMETRY
	###################
	place $base.fra18 \
        -in .top17 -x 5 -y 5 -width 600 -height 185 -anchor nw \
        -bordermode ignore 
	place $base.fra18.cpd19 \
        -in .top17.fra18 -x 10 -y 10 -width 500 -height 25 -anchor nw \
        -bordermode ignore 
	pack $base.fra18.cpd19.01 \
        -in .top17.fra18.cpd19 -anchor center -expand 0 -fill none -padx 2 \
        -pady 2 -side left 
	pack $base.fra18.cpd19.02 \
        -in .top17.fra18.cpd19 -anchor center -expand 1 -fill x -padx 2 \
        -pady 2 -side right 
	place $base.fra18.but20 \
        -in .top17.fra18 -x 520 -y 10 -anchor nw -bordermode ignore 
	place $base.fra18.cpd21 \
        -in .top17.fra18 -x 10 -y 40 -width 500 -height 25 -anchor nw \
        -bordermode ignore 
	pack $base.fra18.cpd21.01 \
        -in .top17.fra18.cpd21 -anchor center -expand 0 -fill none -padx 2 \
        -pady 2 -side left 
	pack $base.fra18.cpd21.02 \
        -in .top17.fra18.cpd21 -anchor center -expand 1 -fill x -padx 2 \
        -pady 2 -side right 
	place $base.fra18.but22 \
        -in .top17.fra18 -x 520 -y 40 -anchor nw -bordermode ignore 
	place $base.fra18.cpd23 \
        -in .top17.fra18 -x 10 -y 70 -width 500 -height 25 -anchor nw \
        -bordermode ignore 
	pack $base.fra18.cpd23.01 \
        -in .top17.fra18.cpd23 -anchor center -expand 0 -fill none -padx 2 \
        -pady 2 -side left 
	pack $base.fra18.cpd23.02 \
        -in .top17.fra18.cpd23 -anchor center -expand 1 -fill x -padx 2 \
        -pady 2 -side right 
	place $base.fra18.but24 \
        -in .top17.fra18 -x 520 -y 70 -anchor nw -bordermode ignore 
	place $base.fra18.cpd25 \
        -in .top17.fra18 -x 10 -y 100 -width 500 -height 25 -anchor nw \
        -bordermode ignore 
	pack $base.fra18.cpd25.01 \
        -in .top17.fra18.cpd25 -anchor center -expand 0 -fill none -padx 2 \
        -pady 2 -side left 
	pack $base.fra18.cpd25.02 \
        -in .top17.fra18.cpd25 -anchor center -expand 1 -fill x -padx 2 \
        -pady 2 -side right 
	place $base.fra18.but26 \
        -in .top17.fra18 -x 520 -y 100 -anchor nw -bordermode ignore 
	place $base.fra18.but27 \
        -in .top17.fra18 -x 525 -y 150 -width 67 -height 26 -anchor nw \
        -bordermode ignore 
	place $base.fra28 \
        -in .top17 -x 5 -y 200 -width 600 -height 300 -anchor nw \
        -bordermode ignore 
	place $base.fra28.lab29 \
        -in .top17.fra28 -x 5 -y 5 -anchor nw -bordermode ignore 
	place $base.fra28.cpd30 \
        -in .top17.fra28 -x 5 -y 25 -width 310 -height 25 -anchor nw \
        -bordermode ignore 
	pack $base.fra28.cpd30.01 \
        -in .top17.fra28.cpd30 -anchor center -expand 0 -fill none -padx 2 \
        -pady 2 -side left 
	pack $base.fra28.cpd30.02 \
        -in .top17.fra28.cpd30 -anchor center -expand 1 -fill x -padx 2 \
        -pady 2 -side right 
	place $base.fra28.cpd31 \
        -in .top17.fra28 -x 325 -y 25 -width 260 -height 25 -anchor nw \
        -bordermode ignore 
	pack $base.fra28.cpd31.01 \
        -in .top17.fra28.cpd31 -anchor center -expand 0 -fill none -padx 2 \
        -pady 2 -side left 
	pack $base.fra28.cpd31.02 \
        -in .top17.fra28.cpd31 -anchor center -expand 1 -fill x -padx 2 \
        -pady 2 -side right 
	place $base.fra28.cpd32 \
        -in .top17.fra28 -x 5 -y 55 -width 515 -height 25 -anchor nw \
        -bordermode ignore 
	pack $base.fra28.cpd32.01 \
        -in .top17.fra28.cpd32 -anchor center -expand 0 -fill none -padx 2 \
        -pady 2 -side left 
	pack $base.fra28.cpd32.02 \
        -in .top17.fra28.cpd32 -anchor center -expand 1 -fill x -padx 2 \
        -pady 2 -side right 
	place $base.fra28.but33 \
        -in .top17.fra28 -x 525 -y 55 -width 63 -height 26 -anchor nw \
        -bordermode ignore 
	place $base.fra28.cpd34 \
        -in .top17.fra28 -x 5 -y 85 -width 585 -height 25 -anchor nw \
        -bordermode ignore 
	pack $base.fra28.cpd34.01 \
        -in .top17.fra28.cpd34 -anchor center -expand 0 -fill none -padx 2 \
        -pady 2 -side left 
	pack $base.fra28.cpd34.02 \
        -in .top17.fra28.cpd34 -anchor center -expand 1 -fill x -padx 2 \
        -pady 2 -side right 
	place $base.fra28.cpd35 \
        -in .top17.fra28 -x 5 -y 110 -width 585 -height 25 -anchor nw \
        -bordermode ignore 
	pack $base.fra28.cpd35.01 \
        -in .top17.fra28.cpd35 -anchor center -expand 0 -fill none -padx 2 \
        -pady 2 -side left 
	pack $base.fra28.cpd35.02 \
        -in .top17.fra28.cpd35 -anchor center -expand 1 -fill x -padx 2 \
        -pady 2 -side right 
	place $base.fra28.cpd36 \
        -in .top17.fra28 -x 5 -y 135 -width 585 -height 25 -anchor nw \
        -bordermode ignore 
	pack $base.fra28.cpd36.01 \
        -in .top17.fra28.cpd36 -anchor center -expand 0 -fill none -padx 2 \
        -pady 2 -side left 
	pack $base.fra28.cpd36.02 \
        -in .top17.fra28.cpd36 -anchor center -expand 1 -fill x -padx 2 \
        -pady 2 -side right 
	place $base.fra28.cpd37 \
        -in .top17.fra28 -x 5 -y 160 -width 585 -height 25 -anchor nw \
        -bordermode ignore 
	pack $base.fra28.cpd37.01 \
        -in .top17.fra28.cpd37 -anchor center -expand 0 -fill none -padx 2 \
        -pady 2 -side left 
	pack $base.fra28.cpd37.02 \
        -in .top17.fra28.cpd37 -anchor center -expand 1 -fill x -padx 2 \
        -pady 2 -side right 
	place $base.fra28.cpd38 \
        -in .top17.fra28 -x 5 -y 185 -width 585 -height 25 -anchor nw \
        -bordermode ignore 
	pack $base.fra28.cpd38.01 \
        -in .top17.fra28.cpd38 -anchor center -expand 0 -fill none -padx 2 \
        -pady 2 -side left 
	pack $base.fra28.cpd38.02 \
        -in .top17.fra28.cpd38 -anchor center -expand 1 -fill x -padx 2 \
        -pady 2 -side right 
	place $base.fra28.cpd39 \
        -in .top17.fra28 -x 5 -y 210 -width 585 -height 25 -anchor nw \
        -bordermode ignore 
	pack $base.fra28.cpd39.01 \
        -in .top17.fra28.cpd39 -anchor center -expand 0 -fill none -padx 2 \
        -pady 2 -side left 
	pack $base.fra28.cpd39.02 \
        -in .top17.fra28.cpd39 -anchor center -expand 1 -fill x -padx 2 \
        -pady 2 -side right 
	place $base.fra28.cpd40 \
        -in .top17.fra28 -x 5 -y 235 -width 585 -height 25 -anchor nw \
        -bordermode ignore 
	pack $base.fra28.cpd40.01 \
        -in .top17.fra28.cpd40 -anchor center -expand 0 -fill none -padx 2 \
        -pady 2 -side left 
	pack $base.fra28.cpd40.02 \
        -in .top17.fra28.cpd40 -anchor center -expand 1 -fill x -padx 2 \
        -pady 2 -side right 
	place $base.fra28.but41 -x 5 -y 265 -anchor nw -bordermode ignore 
	place $base.fra28.skip -x 255 -y 265 -anchor nw -bordermode ignore 
	place $base.fra28.but42 -x 515 -y 265 -anchor nw -bordermode ignore 
	place $base.lab43 \
        -in .top17 -x 10 -y 505 -width 491 -height 18 -anchor nw \
        -bordermode ignore 
	place $base.but44 \
        -in .top17 -x 540 -y 505 -width 67 -height 26 -anchor nw \
        -bordermode ignore 
	place $base.noninv -x 10 -y 505 -height 26 -anchor nw \
        -bordermode ignore
}

Window show .
Window show .top17

