Jump to content

Recommended Posts

Posted

Hi,

I did a quick search of the forum about this but didn't find anything specific.

So, here's my question:

- I have a .reg file created by an export from regedit.

- I've written an AutoIt script that installs an application.

- I need to set some entries in the registry during the install.

- Is there a way, has anyone written a script that I can use the native .reg file contents to update the regitry in my AI script?

I know I can read the .reg file with AI's iniread since the [hive\key] looks just like a ini key, but I won't know the hive\key ahead of time.

Any ideas?

Thanks,

Mac

  • 5 weeks later...
Posted

  elpalmer said:

Will RegWrite work for you?

<{POST_SNAPBACK}>

Hello,

I'd like to create a .reg export with an autoit script alone. I know that I could call regedit or regini to do it but I'm looking for something like the opposite of reg2au3.au3. I essentially need to generate a .reg file using a Regread result.

Thanks

This signature is computer generated, nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#.......

Posted
  mac1 said:

I know I can read the .reg file with AI's iniread since the [hive\key] looks just like a ini key, but I won't know the hive\key ahead of time.

I don't understand that problem. A .reg file has the same format as a .ini file, so why can't you use the ini functions to feed the regwrite function?
Posted

  anystupidassname said:

Hello,

I'd like to create a .reg export with an autoit script alone. I know that I could call regedit or regini to do it but I'm looking for something like the opposite of reg2au3.au3. I essentially need to generate a .reg file using a Regread result.

Thanks

<{POST_SNAPBACK}>

Why don't you want to do RegEdit or REG EXPORT?

What you basically need is to write a recurse registry reader (I think that there is one on this board somewhere, but I could be wrong) and interface it to the iniwrite() function. Oh, and to make it a true .reg file, you'll need to write the header line before anything else.

Posted (edited)

  blindwig said:

Why don't you want to do RegEdit or REG EXPORT?

What you basically need is to write a recurse registry reader (I think that there is one on this board somewhere, but I could be wrong) and interface it to the iniwrite() function.  Oh, and to make it a true .reg file, you'll need to write the header line before anything else.

<{POST_SNAPBACK}>

Thanks for the reply. I can't use "reg export" because that is only available in XP. I can't use regedit because it cannot do individual values. So far I've been using:

$var = Regread ("HKEY_LOCAL_MACHINE\blah", "blah")
FileWrite($file, "Windows Registry Editor Version 5.00" & @CRLF & @CRLF)
FileWrite($file, "[HKEY_LOCAL_MACHINE\SOFTWARE\blah]" & @CRLF)
FileWrite($file, '"blah"=hex:' & $var)
FileClose($file)

The problem with that method is that I have a value that regread is reading as "CE00062E7E206641BDB3388A05CCBD52" when it is actually "ce,00,06,2e,7e,20,66,41,bd,b3,38,8a,05,cc,bd,52"

I doubt the case matters but the commas DO... This method would works for other data values :)

Edited by anystupidassname

This signature is computer generated, nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#.......

Posted

  anystupidassname said:

Thanks for the reply. I can't use "reg export" because that is only available in XP. I can't use regedit because it cannot do individual values. So far I've been using:

$var = Regread ("HKEY_LOCAL_MACHINE\blah", "blah")
FileWrite($file, "Windows Registry Editor Version 5.00" & @CRLF & @CRLF)
FileWrite($file, "[HKEY_LOCAL_MACHINE\SOFTWARE\blah]" & @CRLF)
FileWrite($file, '"blah"=hex:' & $var)
FileClose($file)

The problem with that method is that I have a value that regread is reading as "CE00062E7E206641BDB3388A05CCBD52" when it is actually "ce,00,06,2e,7e,20,66,41,bd,b3,38,8a,05,cc,bd,52"

I doubt the case matters but the commas DO... This method would works for other data values  :)

<{POST_SNAPBACK}>

So put the commas in:

FileWrite($file, '"blah"=hex:' & StringLeft($var, 2))
For $i = 3 to StringLen($var) Step 2
    FileWrite($file, ',' & StringMid($var, $i, 2))
Next;$i
FileWrite($file, @CRLF)

And if case matters to you, put "$var = StringUpper($var)" before that.

Posted

  blindwig said:

So put the commas in:

FileWrite($file, '"blah"=hex:' & StringLeft($var, 2))
For $i = 3 to StringLen($var) Step 2
    FileWrite($file, ',' & StringMid($var, $i, 2))
Next;$i
FileWrite($file, @CRLF)

And if case matters to you, put "$var = StringUpper($var)" before that.

<{POST_SNAPBACK}>

Thanks! Using your example, I got it working. You rule... :)

In the interest of learning more, would anybody have any suggestions on alternative ways to do this? For example, using iniwrite? I so often end up making bloated code and see somebody else do the same thing so cleanly a while later...

This signature is computer generated, nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#.......

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
  • Recently Browsing   0 members

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