Loading ...
Sorry, an error occurred while loading the content.

Re: [NTS] Re: Registry Browser (Notetab+Perl)

Expand Messages
  • Sheri
    Hi again, ... The following works (just change the regular clips to ^!RunPerl these alt versions instead of the other ones). It has all the same stuff in the
    Message 1 of 17 , May 14, 2003
    • 0 Attachment
      Hi again,

      At 01:32 AM 5/14/03 -0700, you wrote:
      >But I still don't know how to READ :-(

      The following works (just change the regular clips to ^!RunPerl these alt versions instead of the other ones). It has all the same stuff in the use statement as yours, except I quickly discovered problems with using "/" (some subbranches have that in their name) as a delimiter and reverted to "\\". All I had to do was replace all my

      "$key->" stuff

      with

      "$Registry->{"$Branch"}"

      Doesn't even need the eval anymore; ditto for _AltPerlRegValScript further down.

      Sheri

      H="_AltPerlRegScript"
      #;5/14/03 alternate version
      use strict;
      my $Registry;
      use Win32::TieRegistry 0.24 (
      TiedRef => \$Registry, Delimiter => "\\\\", ArrayValues => 1,
      SplitMultis => 1, AllowLoad => 1,
      qw( REG_SZ REG_EXPAND_SZ REG_DWORD REG_BINARY REG_MULTI_SZ
      KEY_READ KEY_WRITE KEY_ALL_ACCESS ),
      );
      #my $Branch=$ARGV[0];
      my $Branch = <STDIN>;
      chomp $Branch;
      #double up slashes for use in tieregistry
      $Branch =~ s/\\/\\\\/g;
      my ($key, $valcount, @names, @namesunsort, @subbranches, @subbranches_unsort, $subkeycount);
      @namesunsort = $Registry->{"$Branch"}->ValueNames;
      @names = sort(@namesunsort);
      $valcount = @names;
      if ($valcount>0) {print "Show the $valcount Value Keys\n";}
      @subbranches_unsort = $Registry->{"$Branch"}->SubKeyNames;
      @subbranches = sort(@subbranches_unsort);
      $subkeycount = @subbranches;
      #Problem! $subkeycount isn't working
      if ($subkeycount = 0) {print "No Subkey Branches Found\n";}
      else {
      foreach $_(@subbranches){
      print;
      print "\n";
      }
      }
      if ($valcount>0) {
      print "XSEPX\n";
      print "Return to Subkey Branch Display\n";
      foreach $_(@names){
      print;
      print "\n";
      }
      }


      H="_AltPerlRegValScript"
      #;5/14/03 alternate version
      use strict;
      my $Registry;
      use Win32::TieRegistry 0.24 (
      TiedRef => \$Registry, Delimiter => "\\\\", ArrayValues => 1,
      SplitMultis => 1, AllowLoad => 1,
      qw( REG_SZ REG_EXPAND_SZ REG_DWORD REG_BINARY REG_MULTI_SZ
      KEY_READ KEY_WRITE KEY_ALL_ACCESS ),
      );
      my ($key, $valueString, $valname, $valuetype, $Branch,);
      #double up slashes for use in tieregistry
      while (<STDIN>) {
      chomp; # avoid \n on last field
      ($Branch, $valname) = split(/::/);
      }
      $Branch =~ s/\\/\\\\/g;
      #my $keyq = qq(new Win32::TieRegistry "$Branch");
      #$key = eval($keyq);
      ($valueString,$valuetype) = $Registry->{"$Branch"}->GetValue("$valname");
      if ($valuetype == 3) {print "unprintable data, type $valuetype";}
      elsif ($valuetype == 7) {print "unprintable data, type $valuetype";}
      else {print "Data type\: ", $valuetype, "\n\nValue\: ", $valueString;}
      #end of script
    • Alan C.
      ... Then what s a sub? I thought it be keys and *sub* keys as in Key: hkey_current_user software myalancapps sub key underneath the above key:
      Message 2 of 17 , May 15, 2003
      • 0 Attachment
        On Wed, 14 May 2003 08:35:41 -0400, Sheri wrote:
        >Hi Alan,
        >
        >At 01:06 AM 5/14/03 -0700, you wrote:
        >
        >>>Did you get a chance to try the other one, the custom
        >>>function? I was curious if it works on winvers >�98se.
        >>
        >>Just did. �Win 2k. �Works fine on the first recurse it lists subs
        >>as well as the data or value of a key.
        >
        >Hmmn. That one isn't supposed to be listing subs. You supply the
        >sub, it lists the key names in a clip wizard.

        Then what's a sub? I thought it be keys and *sub* keys as in

        Key:
        hkey_current_user\software\myalancapps

        sub key underneath the above key:
        hkey_current_user\software\myalancapps\app1

        >Were you running my
        >"Test GetRegSubKeys" ?

        Yes.

        >
        >>But after choosing a key then it reports the value of key is:
        >>
        >>and its blank, nothing listed for value. �i look regedit there's
        >>two values in the key that i picked with your clip
        >
        >Two values in a key? Maybe is a type the Notetab ^$GetRegValue$
        >function doesn't read.

        (if I have my terminology correct) Seems to me that Perl script the other day that created a few new keys did create that one of the keys created had three separate values in it (yes, some were binary probably unreadable by NoteTab). But,

        It was a text value that I was speaking of that your clip displayed on first recurse only.

        As I said, it was read on the first of several what I call recurses. For example, here what I did:

        Actually it was a key the first time then run the clip. I Hard coded the next into the clip:

        hkey_current_user\software\myalancapps

        run clip. clip dialog comes up with that in the dialog and selected. Then just ok the dialog. Next comes up yet another dialog that shows the initially entered item (can choose it), also shows (it's here the value and its content is shown) the value (registerednotregistered) AND sub keys so as to choose a sub key

        Next, choose from items shown in wizard, choose and ok the same item as initially entered. it's the next dialog is when the listing is blank of any value.

        So, this is what I meant by the statement: any value in the hard coded key is listed/shown on first recurse. Choose same key again and the listing/value_shown comes up blank.

        (I substituted my name I don't really have an app authored by me) but just to show the structure of the reg keys I ran your clip on:

        hkey_current_user\software\myalancapps

        hkey_current_user\software\myalancapps\app1

        hkey_current_user\software\myalancapps\app1
        the value: registeredyesno textdataofyesorno

        hkey_current_user\software\myalancapps\app1\tips
        the values: several values for tips 2 be displayed


        hkey_current_user\software\myalancapps\app2

        hkey_current_user\software\myalancapps\app2\tips

        --
        Alan.
      • Sheri
        Thanks Alan, From what you ve said, I think that the regedit export file must be a little different in Win 2k than my 98. You should only see the names of
        Message 3 of 17 , May 15, 2003
        • 0 Attachment
          Thanks Alan,

          From what you've said, I think that the regedit export file must be a little different in Win 2k than my 98.

          You should only see the names of Values in that second wizard, and not see or get to select again the branch or any subbranches. (I thought "Value Names" were called "Keys" when I wrote that clip).

          I found a glitch in my Perl registry browser too. Turns out "default" Values are unnamed. A ^$StrTrim$ I was using in the clip was removing blank value names.

          I've made some more changes in my Perl regbrowser and I'm not sure why, but multi's and binary values retrieved no longer crash the clip. Now multis display as "Array(...)" and binaries just show up blank.

          Weird.

          Regards,
          Sheri
        • Sheri
          Hi again Alan, Solved the problem of showing multi values such as the fonts entry for FooWriter. Have to refer to the valueString as an array if the data type
          Message 4 of 17 , May 16, 2003
          • 0 Attachment
            Hi again Alan,

            Solved the problem of showing multi values such as the fonts entry for FooWriter. Have to refer to the valueString as an array if the data type is REG_MULTI_SZ, i.e., @$valueString.

            This version does that and depicts default value names as .Default in clip wizards (but retrieves the actual values using "").

            Sheri

            H="Browse Registry via Perl"
            ;Created by Sheri Pierce 5/10/03
            ;5/16/03 version
            ^!Info This clip captures the currently selected subkey branch and value key name on the clipboard.
            :Start
            ^!Set %Branch%=""
            ^!Set %curdoc%="^$GetDocName$"
            ^!SetWizardLabel
            ^!Set %Root%=HKEY_CLASSES_ROOT|HKEY_CURRENT_USER|HKEY_LOCAL_MACHINE|HKEY_USERS|HKEY_CURRENT_CONFIG
            ^!Set %Branch%="^?{(T=L;H=5)Enter Registry Branch=^%Root%}"
            ^!IfCancel Out
            ^!SetClipboard ^%Branch%
            :PerlSubs
            ^!Setscreenupdate off
            ^!Menu File/New
            ^!InsertText ^%Branch%
            ;^!RunPerl "PerlRegScript"
            ^!RunPerl "AltPerlRegScript"
            ^!IfFileExist ^$GetAppPath$StdError.err PerlError
            ^!SetListDelimiter XSEPX^P
            ^!SetArray %SubsandVals%="^$StrTrim("^$GetText$")$"
            ^!Clip "BrowseRegSubClip"
            ^!DestroyDoc
            ^!SetDocIndex=^$GetDocIndex("^%curdoc%")$
            :ShowSubs
            ^!Set %count%=0
            ^!Set %choices%=""
            ^!If ^$StrPos("\";"^%Branch%";No)$>0 Next Else Skip_2
            ^!Set %choices%="_Up a level|"
            ^!Goto Loop
            ^!Set %choices%="_Up to Root|"
            :Loop
            ^!Inc %count%
            ^!If ^%count%>^%Subkeys0% Doit
            ^!Append %choices% ^%Subkeys^%count%%|
            ^!Goto Loop
            :Doit
            ^!SetWizardLabel ^%Branch%
            ^!Set %oldchosen%=^%chosen%
            ^!Set %chosen%=^?{(T=L;H=15)Select a key=^%choices%}
            ^!IfCancel Out
            ^!If ^%chosen%="Up a level" Up_Level
            ^!If ^%chosen%="Up to Root" Start
            ^!IfMatch "Show the \d+ Value Keys" "^%chosen%" ShowVals
            ^!IfMatch "No Subkey Branches Found" "^%chosen%" Skip_-5
            ^!IfTrue ^$IsEmpty(^%chosen%)$ Skip_-6
            ^!Set %Branch%="^%Branch%\^%chosen%"
            ^!SetClipboard ^%Branch%
            ^!Goto PerlSubs
            :Up_Level
            ^!Set %size%=^$StrSize("^%Branch%")$
            ^!Set %LastSlash%=^$StrPosRight("\";"^%Branch%";No)$
            ^!If ^%LastSlash%=0 Root
            ^!Set %Branch%=^$StrDeleteRight("^%Branch%";^$Calc(^%size%-^%LastSlash%+1)$)$
            ^!Goto PerlSubs
            :Root
            ^!Set %Branch%=""
            ^!Goto Start
            :ShowVals
            ^!Set %count%=0
            ^!Set %keychoices%=""
            :LoopVals
            ^!Inc %count%
            ^!If ^%count%>^%Valkeys0% Dovals
            ^!Append %keychoices% ^%Valkeys^%count%%|
            ^!Goto LoopVals
            :Dovals
            ^!Set %key%=^?{Select key==^%keychoices%}
            ^!IfCancel Out
            ^!IfMatch "Return to Subkey Branch Display.*" "^%key%" ShowSubs
            ^!IfMatch "\.Default" "^%key%" Next Else Skip_1
            ^!Set %key%=""
            ^!SetClipboard ^%Branch%:^%key%
            :PerlInfo
            ^!Menu File/New
            ^!InsertText ^%Branch%::^%key%
            ;^!RunPerl "PerlRegValScript"
            ^!RunPerl "AltPerlRegValScript"
            ^!Set %ValViaPerl%=^$StrTrim(^$GetText$)$
            ^!IfFileExist ^$GetAppPath$StdError.err PerlError
            ^!DestroyDoc
            ^!SetDocIndex=^$GetDocIndex("^%curdoc%")$
            ^!IfTrue ^$IsEmpty(^$GetRegValue("^%Branch%:^%key%")$)$ Next Else Skip_2
            ^!Info Notetab's ^^%caret%$GetRegValue$ function doesn't read this key!^PRegistry Value via Perl^P=^P^%ValViaPerl%
            ^!Goto Skip_1
            ^!Info Registry Value via Notetab GetRegValue (seems to work only when the value contains string or decimal value)^P =^P ^$GetRegValue("^%Branch%:^%key%")$^P===^PRegistry Value via Perl^P=^P^%ValViaPerl%
            ^!Goto Dovals
            :Out
            ^!Info Reminder: the last used branch and valuekey (if any) is on the clipboard.
            ^!ClearVariable %PassBranch%
            ^!Goto End
            :PerlError
            ^!Info Sorry, there was a Perl Error.
            ^!Open ^$GetAppPath$StdError.err


            H="_BrowseRegSubClip"
            ^!SetListDelimiter ^P
            ^!SetArray %Subkeys%=^%SubsandVals1%
            ^!SetArray %Valkeys%=^%SubsandVals2%


            H="_AltPerlRegScript"
            #;5/16/03 alternate version
            use strict;
            my $Registry;
            use Win32::TieRegistry 0.24 (
            TiedRef => \$Registry, Delimiter => "\\\\", ArrayValues => 1,
            SplitMultis => 1, AllowLoad => 1,
            qw( REG_SZ REG_EXPAND_SZ REG_DWORD REG_BINARY REG_MULTI_SZ
            KEY_READ KEY_WRITE KEY_ALL_ACCESS ),
            );
            #my $Branch=$ARGV[0];
            my $Branch = <STDIN>;
            chomp $Branch;
            #double up slashes for use in tieregistry
            $Branch =~ s/\\/\\\\/g;
            my ($cntSubKeys,$valcount, @names, @namesunsort, @subbranches, @subbranches_unsort, $subkeycount);
            @namesunsort = $Registry->{"$Branch"}->ValueNames;
            @names = sort(@namesunsort);
            $valcount = @names;
            if ($valcount>0) {print "Show the $valcount Value Keys\n";}
            @subbranches_unsort = $Registry->{"$Branch"}->SubKeyNames;
            @subbranches = sort(@subbranches_unsort);
            $cntSubKeys = @subbranches;
            #%keyInfo= $Registry->{"$Branch"}->Information;
            #Alternate way to get counts
            #( $cntSubKeys )= $Registry->{"$Branch"}->Information( "CntSubKeys" );
            #print "cntSubKeys is $cntSubKeys\n";
            #$savecnt = $cntSubKeys;
            if ($cntSubKeys == 0) {print "No Subkey Branches Found\n";}
            else {
            foreach $_(@subbranches){
            print;
            print "\n";
            }
            }
            if ($valcount>0) {
            print "XSEPX\n";
            print "_Return to Subkey Branch Display \($cntSubKeys\)\n";
            foreach $_(@names){
            if ($_ ne "") {print "$_\n";}
            else {print "\.Default\n";}
            }
            }

            H="_AltPerlRegValScript"
            #;5/16/03 alternate version
            use strict;
            my $Registry;
            use Win32::TieRegistry 0.24 (
            TiedRef => \$Registry, Delimiter => "\\\\", ArrayValues => 1,
            SplitMultis => 1, AllowLoad => 1,
            qw( REG_SZ REG_EXPAND_SZ REG_DWORD REG_BINARY REG_MULTI_SZ
            KEY_READ KEY_WRITE KEY_ALL_ACCESS ),
            );
            my ($valueString, $valname, $valuetype, $Branch,);
            #my $Branch=$ARGV[0];
            #my $Branch = <STDIN>;
            #chomp $Branch;
            #double up slashes for use in tieregistry
            while (<STDIN>) {
            chomp; # avoid \n on last field
            ($Branch, $valname) = split(/::/);
            }
            $Branch =~ s/\\/\\\\/g;
            ($valueString,$valuetype) = $Registry->{"$Branch"}->GetValue("$valname");
            if (($valuetype =~ /MULTI/) or ($valuetype == 7)) {print "Data type\: ", $valuetype, "\nValue\: ", @$valueString;}
            else {print "Data type\: ", $valuetype, "\nValue\: ", $valueString;}
            #end of script
          Your message has been successfully submitted and would be delivered to recipients shortly.