Jump to content

.reg To Au3


Dan
 Share

Recommended Posts

  • 1 month later...

Just a small note, I like to comment what I am doing in my .reg files. Your script does not take any comments into account (comments meaning anything starting with ";"). It throws an error when a comment is encountered.

Who else would I be?
Link to comment
Share on other sites

Dan

There is a problem when the valuedata contains a "=" in it.

I have a few appz I have purchased with serials that contain "=".

Example: lkuyshoriufjkhiucs=lkuahgkdjAOcxzc==

The following will eliminate this problem and I am hoping you will update your post to reflect it. If I am wrong please correct me, I am a quick learner but still very new to AutoIt Scripting.

Remove: $TEMP = StringSplit($TEXT, "=");split line into value and valuedata

And replace with:

For $I = 1 To StringLen($TEXT)

If StringMid( $TEXT, $I, 1) = "=" Then

$TEMP1 = StringLeft($TEXT, $I - 1)

$TEMP2= StringTrimLeft($TEXT, $I)

ExitLoop

EndIf

Next

Then you need to replace the following in the entire script: $TEMP[1] with $TEMP1 and $TEMP[2] with $TEMP2

Edited by bshoenhair
Link to comment
Share on other sites

  • 2 weeks later...

In looking at the script, i found a couple more issues related to " and = characters in names and data. I made the simple change to allow for comments as requested and will check out the remaining issue within the next few days.

Edited by Dan
Link to comment
Share on other sites

  • 3 weeks later...

I couldn't sleep so I made my own version.

My version:

  • adds comments (when available)
  • Uses RegDelete instead of RegWrite when needed
  • can't handle "REG_MULTI_SZ" and "REG_EXPAND_SZ"

    (I have no idea how I can convert those...)

Available below:

http://www.autoitscript.com/fileman/users/public/SlimShady/Reg2Au3.au3

Edited by SlimShady
Link to comment
Share on other sites

Updated.

It now supports:

"REG_SZ", "REG_MULTI_SZ", "REG_EXPAND_SZ", "REG_DWORD", "REG_BINARY".

I used information from Dan's CharsToString function.

Test it on a dummy registry file first to be sure that nothing scr*ws up.

http://www.autoitscript.com/fileman/users/public/SlimShady/Reg2Au3.au3

Link to comment
Share on other sites

  • 2 years later...

Updated.

It now supports:

"REG_SZ", "REG_MULTI_SZ", "REG_EXPAND_SZ", "REG_DWORD", "REG_BINARY".

I used information from Dan's CharsToString function.

Test it on a dummy registry file first to be sure that nothing scr*ws up.

http://www.autoitscript.com/fileman/users/public/SlimShady/Reg2Au3.au3

Thanks but the link seems to be dead now.

Link to comment
Share on other sites

Good scripting here. Glad to see other's take interest in .reg like I do.

A couple things to say here.

First and foremost, unless you are working on a 9x machine, why do you export as 9x? That exports at UTF-8, which converts your UTF-16 registry (2k & xp) down to UTF-8. In simple terms, you are exporting Unicode to Ascii/ANSI. There are many characters that could be in your registry that will never be imported in again. Both binary and strings.

Second, the full set of values that I can convert and use in a .reg file are:

REG_SZ,REG_BINARY,REG_MULTI_SZ,REG_EXPAND_SZ,REG_DWORD,REG_QWORD,REG_FULL_RESOURCE_DESCRIPTOR

and one I just found about, a Multiple-line REG_SZ (not REG_MULTI_SZ).

I have been working on a script to convert .reg to .inf. I was doing as you, with UTF-8, but have found numerous reasons to keep the Unicode.

Also, there is a method to simply convert Unicode to Ascii by using the Run(@comspec) & Type command. This will work, but not on hex(7) (reg_multi_sz) values. Because the binary is actually a hex value of what a hex value should import as, the conversion has no need to convert binary, so it leaves it. Meaning when you parst hex(7) thinking it is UTF-8, it is still UTF-16 binary, which needs to be converted to Chars of the hex, which can then be Char'd to string. Umm. Somewhat confusing. Just look at a Unicode .reg file for hex(7) values, and do a char function on it to see what I mean. It needs it twice. This means nothing though if you export as 9x, because any UTF-16 is not there.

later,

Sul

Link to comment
Share on other sites

  • 5 months later...
  • 3 months later...

Anyone have a modified script that can handle Hex A and Hex 8 values?

EDIT: For those telling me I should have posted this in the General Support forum, I'm sorry, didn't know that. Thought I was asking for an "example script", but now I know you don't ask for "example scripts" in the "example script" forum. Got it, won't happen again.

Edited by Jazkal
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...