Macro for exported registry saves

Macro for exported registry saves

161
Basic UserBasic User
161

    Sep 12, 2005#1

    I am exporting certain parts of my registry into a .txt file. The output looks something like so:

    Key Name: HKEY_CURRENT_USER\XXXXX\\Recorded
    Class Name: <NO CLASS>
    Last Write Time: 9/11/2005 - 6:12 PM
    Value 0
    Name: Something
    Type: Useless information
    Data: 192.168.1.1

    Value 1
    Name: Something else
    Type: Useless information
    Data: 192.000.1.2

    It then continues by adding +1 to Value. So Value 0, Value 1, Value 2, Value 3, Value 4, etc. The Type always stays the same, and the Name/Data wil already change.

    I want the final result to be:

    Data - Name

    Such as:
    192.000.1.2 - Something else
    192.168.1.1 - Something

    First, it seems like I should deleted lines 1-3. Then replace all lines containing "Name:"

    But I am not sure how I can do a reverse sort for the IP so it is in front of the name.

    Is this too much to ask for, or can someone provide a fairly easy solution?

    6,686585
    Grand MasterGrand Master
    6,686585

      Sep 12, 2005#2

      Try this macro:

      InsertMode
      ColumnModeOff
      HexOff
      UnixReOff
      Bottom
      IfColNum 1
      Else
      "
      "
      EndIf
      Top
      Find RegExp "%Key Name:*^pClass Name:*^pLast Write Time*^p"
      Replace All ""
      Find RegExp "%Type:*^p"
      Replace All ""
      Find RegExp "%Name: ^(*^)^pData: ^(*^)$"
      Replace All "^2 - ^1"
      UnixReOn

      Remove the last red command, if you use regular expression in UltraEdit style by default instead of Unix style - see Advanced - Configuration - Find - Unix style Regular Expressions. UnixReOn/UnixReOff modifies this setting.

      The first part of the macro makes sure, that last line with data has a line ending. The first regular expression deletes the first 3 lines. Next regular expression deletes the type line. The last regular expression reoders the data you want.

      Hope your example text was correct!
      Best regards from an UC/UE/UES for Windows user from Austria

      161
      Basic UserBasic User
      161

        Sep 12, 2005#3

        Hey, when I try it, it automatically says search string not found...


        Here is the actual output of the txt file >

        Code: Select all

        Key Name:          HKEY_CURRENT_USER\Software\VB and VBA Program Settings\V3-R\Recorded
        Class Name:        <NO CLASS>
        Last Write Time:   9/11/2005 - 6:12 PM
        Value 0
          Name:            Something
          Type:            REG_SZ
          Data:            192.168.1.1
        
        Value 1
          Name:            Another Thing
          Type:            REG_SZ
          Data:            192.168.1.190

          Sep 14, 2005#4

          Ah. I ran the macro code on the text I pasted originally, and it almost works without the spaces.

          The "Value 0

          Value 1" etc still appear within the code.

          Once that is fixed, I basically just need to insert some spaces before name and before the units qualifier?

          6,686585
          Grand MasterGrand Master
          6,686585

            Sep 14, 2005#5

            Improved macro according to exact sample text:

            InsertMode
            ColumnModeOff
            HexOff
            UnixReOff
            Bottom
            IfColNum 1
            Else
            "
            "
            EndIf
            Top
            TrimTrailingSpaces
            Find RegExp "%Key Name:*^pClass Name:*^pLast Write Time*^p"
            Replace All ""
            Find RegExp "%Value*^p"
            Replace All ""
            Find RegExp "% +Type:*^p"
            Replace All ""
            Find RegExp "^p^p"
            Replace All "^p"
            Find RegExp "% +Name: +^(*^)^p +Data: +^(*^)$"
            Replace All "^2 - ^1"
            UnixReOn
            Best regards from an UC/UE/UES for Windows user from Austria

            161
            Basic UserBasic User
            161

              Sep 14, 2005#6

              I just tried the macro on the sample I gave, and it shot back an error saying that it could not be found.

              I had this text:

              Code: Select all

              Key Name:          HKEY_CURRENT_USER\Software\VB and VBA Program Settings\V3-R\Recorded
              Class Name:        <NO CLASS>
              Last Write Time:   9/11/2005 - 6:12 PM
              Value 0
                Name:            Something
                Type:            REG_SZ
                Data:            192.168.1.1
              
              Value 1
                Name:            Another Thing
                Type:            REG_SZ
                Data:            192.168.1.190
              And used this macro:

              Code: Select all

              InsertMode
              ColumnModeOff
              HexOff
              UnixReOff
              Bottom
              IfColNum 1
              Else
              "
              "
              EndIf
              Top
              TrimTrailingSpaces
              Find RegExp "%Key Name:*^pClass Name:*^pLast Write Time*^p"
              Replace All ""
              Find RegExp "%Value*^p"
              Replace All ""
              Find RegExp "% +Type:*^p"
              Replace All ""
              Find RegExp "^p^p"
              Replace All "^p"
              Find RegExp "% +Name: +^(*^)^p +Data: +^(*^)$"
              Replace All "^2 - ^1"
              UnixReOn

              6,686585
              Grand MasterGrand Master
              6,686585

                Sep 14, 2005#7

                Enable option Continue if a Find with Replace not found in the properties of this macro.

                And the macro is written for MS-DOS line terminated files. If it is a Unix file replace all ^p by ^n.
                Best regards from an UC/UE/UES for Windows user from Austria

                161
                Basic UserBasic User
                161

                  Sep 15, 2005#8

                  Works like a charm!