You are here

any bady can learn me how Merge or mix two or three setting.reg files in one?( HKCU+HKLM+..to SETTING .REG)

5 posts / 0 new
Last post
habenyamin
Offline
Last seen: 2 years 2 months ago
Joined: 2009-02-06 13:04
any bady can learn me how Merge or mix two or three setting.reg files in one?( HKCU+HKLM+..to SETTING .REG)

any body can learn me how Merge or mix two or three setting.regs in one?( HKCU+HKLM+..to SETTING .REG)

for example.
${registry::SaveKey} "HKEY_LOCAL_MACHINE\SOFTWARE\App" "$SETTINGSDIRECTORY\setting1.reg" "" $R0
${registry::SaveKey} "HKEY_CURRENT_USER\Software\App" "$SETTINGSDIRECTORY\setting2.reg" "" $R0
and...
setting1.reg+setting2.reg+... JUST mix to one SETTING.reg and save to settingdirectory
Thanks

solanus
solanus's picture
Offline
Last seen: 9 years 6 months ago
Joined: 2006-01-21 19:12
reg files are text files

If you export registry settings to .reg files, you can open them in notepad and edit them.

Your setting1.reg will have something like:

Windows Registry Editor 
Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\\App]
"Key1"=dword:00000001
"Key2"=dword:00000001
etc...

Your setting2.reg will have something like:

Windows Registry Editor 
Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\\App]
"Key1"=dword:00000001
"Key2"=dword:00000001
etc...

Copy the text from the first and paste into notepad.
Copy everything except the first two lines from the second and add it to the same new file. It should look like this:

Windows Registry Editor 
Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\\App]
"Key1"=dword:00000001
"Key2"=dword:00000001
etc...

[HKEY_CURRENT_USER\SOFTWARE\\App]
"Key1"=dword:00000001
"Key2"=dword:00000001
etc...

Save as setting.reg

I made this half-pony, half-monkey monster to please you.

OliverK
OliverK's picture
Offline
Last seen: 2 years 10 months ago
Developer
Joined: 2007-03-27 15:21
Yes, but I think he means

Yes, but I think he means with NSIS. I've never tried it. never even thought about it. I don't think NSIS provides for it though.

Too many lonely hearts in the real world
Too many bridges you can burn
Too many tables you can't turn
Don't wanna live my life in the real world

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 10 months ago
Joined: 2007-04-15 21:08
Sort of

The question is not so much does NSIS support it as does RegEdit support it: and the answer is no.

If you like, you could merge the files, chucking away the first two lines. But you'll need to make your own NSIS code to do that (it's not all that hard, just FileRead from one and and FileWrite to the other (appending) after the first two lines).

I really can't see any point in it though. And with a unified launcher it will be entirely unsupported.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

prapper
Offline
Last seen: 3 years 2 months ago
Developer
Joined: 2008-01-24 17:01
Perhaps I am misunderstanding

Perhaps I am misunderstanding the question but here goes...

Backup your registry keys...

RegistryBackup1:
	${registry::KeyExists} "HKCU\Software\REGKEY1-BackupBy${NAME}" $R0
	StrCmp $R0 "0" RegistryBackup2
	${registry::KeyExists} "HKCU\Software\REGKEY1" $R0
	StrCmp $R0 "-1" RegistryBackup2
	${registry::MoveKey} "HKCU\Software\REGKEY1" "HKCU\Software\REGKEY1-BackupBy${NAME}" $R0
	Sleep 100

RegistryBackup2:
	${registry::KeyExists} "HKCU\Software\REGKEY2-BackupBy${NAME}" $R0
	StrCmp $R0 "0" RegistryBackup3
	${registry::KeyExists} "HKCU\Software\REGKEY2" $R0
	StrCmp $R0 "-1" RegistryBackup3
	${registry::MoveKey} "HKCU\Software\REGKEY2" "HKCU\Software\REGKEY2-BackupBy${NAME}" $R0
	Sleep 100

RegistryBackup3:
	${registry::KeyExists} "HKCU\Software\REGKEY3-BackupBy${NAME}" $R0
	StrCmp $R0 "0" RestoreTheKey
	${registry::KeyExists} "HKCU\Software\REGKEY3" $R0
	StrCmp $R0 "-1" RestoreTheKey
	${registry::MoveKey} "HKCU\Software\REGKEY3" "HKCU\Software\REGKEY3-BackupBy${NAME}" $R0
	Sleep 100

On exit, save them...

;RegistryRestore:
	StrCmp $FAILEDTORESTOREKEY "true" SetOriginalKeyBack1
	${registry::SaveKey} "HKCU\Software\REGKEY1" "$SETTINGSDIRECTORY\${NAME}.reg" "" $0
	${registry::SaveKey} "HKCU\Software\REGKEY2" "$SETTINGSDIRECTORY\${NAME}.reg" "/A=1" $0
	${registry::SaveKey} "HKCU\Software\REGKEY3" "$SETTINGSDIRECTORY\${NAME}.reg" "/A=1" $0
	Sleep 100

Note the difference between the end of the first line and the end of all subsequent ones. Where the first one is blank (""), all the others contain "/A=1" (append). Now all three keys are saved to one file ("NAME.reg").

Restore your registry keys...

SetOriginalKeyBack1:
	${registry::DeleteKey} "HKCU\Software\REGKEY1" $R0
	Sleep 100
	${registry::KeyExists} "HKCU\Software\REGKEY1-BackupBy${NAME}" $R0
	StrCmp $R0 "-1" SetOriginalKeyBack2
	${registry::MoveKey} "HKCU\Software\REGKEY1-BackupBy${NAME}" "HKCU\Software\REGKEY1" $R0
	Sleep 100

SetOriginalKeyBack2:
	${registry::DeleteKey} "HKCU\Software\REGKEY2" $R0
	Sleep 100
	${registry::KeyExists} "HKCU\Software\REGKEY2-BackupBy${NAME}" $R0
	StrCmp $R0 "-1" SetOriginalKeyBack3
	${registry::MoveKey} "HKCU\Software\REGKEY2-BackupBy${NAME}" "HKCU\Software\REGKEY2" $R0
	Sleep 100

SetOriginalKeyBack3:
	${registry::DeleteKey} "HKCU\Software\REGKEY3" $R0
	Sleep 100
	${registry::KeyExists} "HKCU\Software\REGKEY3-BackupBy${NAME}" $R0
	StrCmp $R0 "-1" TheEnd
	${registry::MoveKey} "HKCU\Software\REGKEY3-BackupBy${NAME}" "HKCU\Software\REGKEY3" $R0
	Sleep 100
	Goto TheEnd

I just posted these. Process Explorer and Process Monitor both do this. If you want a more elaborate example, take a look at REAPER here.

Again, apologies if this isn't what you mean :-)

Log in or register to post comments