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

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

Expand Messages
  • Sheri
    May 14, 2003
    • 0 Attachment
      Hi Alan,

      OK, I tried your script and it worked fine.

      Then used my clip/script (now enhanced to use GetValue() when Notetab ^$GetRegValue$ returns an empty string) to try to read the 3 new keys. The only one that didn't crash the clip (by trying to print unacceptable data to a Notetab doc I suppose) was TaskBarIcon. I was reading the data type as numeric. I read in the perldoc that if you install module "SetDualVar" it will return the constant name of the data type. So I installed SetDualVar, and that works (but numeric test also seems to still work). I know for sure that REG_BINARY (type 3) and REG_MULTI_SZ (type 7) ones can't print to Notetab so those are excluded (report data type only).

      H="Browse Registry via Perl"
      ;Created by Sheri Pierce 5/10/03
      ;5/14/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"
      ^!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
      ^!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
      ^!SetClipboard ^%Branch%:^%key%
      ^!IfTrue ^$IsEmpty(^$GetRegValue("^%Branch%:^%key%")$)$ Next Else NTInfo
      ^!Setdebug on
      :PerlInfo
      ^!Menu File/New
      ^!InsertText ^%Branch%::^%key%
      ^!RunPerl "PerlRegValScript"
      ^!Set %ValViaPerl%=^$StrTrim(^$GetText$)$
      ^!IfFileExist ^$GetAppPath$StdError.err PerlError
      ^!DestroyDoc
      ^!SetDocIndex=^$GetDocIndex("^%curdoc%")$
      ^!Info Notetab's ^$GetRegValue$ command doesn't read this key!^PRegistry Value via Perl^P^P=^P^P^%ValViaPerl%
      ^!Goto Dovals
      :NTInfo
      ^!Info Registry Value via Notetab GetRegValue (seems to work only when the value contains string or decimal value)^P^P =^P^P ^$GetRegValue("^%Branch%:^%key%")$
      ^!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="_PerlRegScript"
      #;5/14/03 version
      use strict;
      use Win32::TieRegistry;
      #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);
      my $keyq = qq(new Win32::TieRegistry "$Branch");
      $key = eval($keyq);
      #convert to familiar slashes for printing branch name
      $Branch =~ s/\\\\/\\/g;
      @namesunsort = $key->ValueNames;
      @names = sort(@namesunsort);
      $valcount = @names;
      if ($valcount>0) {print "Show the $valcount Value Keys\n";}
      @subbranches_unsort = $key->SubKeyNames;
      @subbranches = sort(@subbranches_unsort);
      $subkeycount = @subbranches;
      #$subkeycount = $key->CntSubKeys;
      #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="_PerlRegValScript"
      #;5/14/03 version
      use strict;
      use Win32::TieRegistry;
      my ($key, $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;
      my $keyq = qq(new Win32::TieRegistry "$Branch");
      $key = eval($keyq);
      ($valueString,$valuetype) = $key->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
    • Show all 17 messages in this topic