mac1 Posted June 23, 2005 Posted June 23, 2005 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
eJan Posted June 23, 2005 Posted June 23, 2005 You can do by importing .reg file with Regedit in silent mode Run("regedit.exe /s file.reg", @ScriptDir)or to use Reg2au3.au3from Sigi2 original topic
anystupidassname Posted July 22, 2005 Posted July 22, 2005 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#.......
blindwig Posted July 23, 2005 Posted July 23, 2005 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? My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions
blindwig Posted July 23, 2005 Posted July 23, 2005 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. My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions
anystupidassname Posted July 25, 2005 Posted July 25, 2005 (edited) 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 July 25, 2005 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#.......
blindwig Posted July 25, 2005 Posted July 25, 2005 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. My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions
anystupidassname Posted July 25, 2005 Posted July 25, 2005 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#.......
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now