############################################################################## #John McKee #reglist.pm # # # This is an extension program to genericreg.pl # 1. This creates a listbox from *.reg's in pwd, # which were created by the user via # custom registy edits. # 2. It lists the name of the regstry edits that # the user requires and allows that user # to select more than one, if so desired. # And allow the user to delete edits no # longer required # ############################################################################## package reglist; use Tk; #Constructor sub new { bless{}; } #end Constructor sub Gui { undef(@selections); my $top = MainWindow->new(); $top->title('Listing of Custom Registry Edits'); #Listbox widget $listbox = $top->ScrlListbox(-label=>"Custom Edits", -height=>6, -selectmode =>"extended", -background=>"DarkSlateGray3"); #end listbox widget #Buttons (Exit, Delete, and Select) $exitbutton = $top->Button(-text =>"Exit", -command=>sub {$top->destroy()}); $deletebutton = $top->Button(-text=>"Delete", -command=>\&del_selection); $selectbutton = $top->Button(-text=>"Select", -command=>\&proc_selection); $okbutton = $top->Button(-text=>"Commit Changes", -command=>\&commit_changes); #end buttons #Sunken Selection Frame $frame = $top->Frame(-relief =>"ridge", -relief=>"raised", -borderwidth =>4, -background=>"DarkSlateGray4"); $label = $frame->Label(-text =>"Selected: ",-background=>"DarkSlateGray3"); $entry = $frame->Label(-textvariable => \$seltext, -relief=>"sunken", -background=>"white"); #end Frame #packs $listbox->pack(-fill=>"both", -expand=>"yes"); $exitbutton->pack(-side=>"left"); $selectbutton->pack(-side=>"left"); $deletebutton->pack(-side=>"right"); $okbutton->pack(-side=>"right"); $frame->pack(-side=>"right", -anchor=>"se",-expand=>"yes",-fill=>"x"); $label->pack(-side=>"left"); $entry->pack(-side=>"left"); #end packs ########################################################################## # Gets all *.reg files from pwd an insert into listbox ########################################################################## open (FD, "dir /B *.reg |") || die "Unable to read"; while () { chop; #Cut newline $listbox->insert("end","$_"); #pull *.reg's into listbox } close (FD); #************************************************************************* $seltext=proc_selection(); MainLoop; } sub proc_selection { ########################################################################## # Store the selections the user makes ########################################################################## $seltext=join(', ',$listbox->Getselected); push (@selections,$listbox->Getselected); #stored in @selections #************************************************************************* } sub del_selection { ########################################################################## # Deletes selected Registry edits ########################################################################## $del_choice = $listbox->get('active'); #gets highlighted selection(s) $listbox->delete('active'); #deletes from listbox system ("erase $del_choice"); #deletes from directory #************************************************************************* } sub commit_changes { ########################################################################## # Reads selection list from the list box and commits those changes # to the registry after the user hits the commit changes button ########################################################################## foreach (@selections) { system ($_); #uses crackjack $_ to run } #each *.reg selected #************************************************************************* } return 1;