You are here

About FileWrite problem when writing data to registry

7 posts / 0 new
Last post
tony200910041
Offline
Last seen: 7 years 9 months ago
Joined: 2013-04-02 07:44
About FileWrite problem when writing data to registry

Hi,
Today I encounter some issue when making a portable application.
There is a path storing in registry, and I use ConfigWrite to modify the path.
However, the registry imported is only the old one. The path is changed, but only changed in the file, instead of the real registry. When I close the application, the old registry values are exported to the registry file. Then the entire ConfigWrite doesn't work.
How can I write data first, and after that, import registry?
Here is the launcher.ini I used:

[Launch]
AppName=JPEGsnoopPortable
ProgramExecutable=JPEGsnoop\JPEGsnoop.exe
SingleAppInstance=true
DirectoryMoveOK=yes

[Activate]
Registry=true

[FileWrite1]
File=%PAL:DataDir%\settings\JPEGsnoop.reg
Type=ConfigWrite
Entry="UserDbPath"=
Value="%PAL:DataDir:DoubleBackslash%\\JPEGsnoop"

[RegistryKeys]
JPEGsnoop=HKCU\Software\ImpulseAdventure\JPEGsnoop

[RegistryCleanupIfEmpty]
1=HKCU\Software\ImpulseAdventure

Thanks for helping.

John T. Haller
John T. Haller's picture
Offline
Last seen: 5 hours 15 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
INI

Registry files are written to as INI files, not config files.

Sometimes, the impossible can become possible, if you're awesome!

JLim
Offline
Last seen: 2 months 2 weeks ago
Joined: 2013-07-17 01:30
Hi, I like to know what is

Hi,
I like to know what is the difference between using [RegistryValueWrite] and [FileWriteN] for the above example?

Are the following two equivalent?

[RegistryValueWrite]
HKCU\Software\ImpulseAdventure\JPEGsnoop\UserDbPath=REG_SZ:%PAL:DataDir%\JPEGsnoop

[FileWrite1]
Type=INI
File=%PAL:DataDir%\settings\JPEGsnoop.reg
Section=HKCU\Software\ImpulseAdventure\JPEGsnoop
Key="UserDbPath"
Value="%PAL:DataDir:DoubleBackslash%\\JPEGsnoop"

John T. Haller
John T. Haller's picture
Offline
Last seen: 5 hours 15 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Direct vs Indirect

FileWrite happens to the reg file before that registry file is imported into the registry. It's how we usually do things as most of what we do is replacing one path with another (aka portablizing paths from the last run location to the current one). RegistryValueWrite isn't used in any of the 300+ apps we have released and I'm not sure when that write happens with respect to a reg file import.

Sometimes, the impossible can become possible, if you're awesome!

JLim
Offline
Last seen: 2 months 2 weeks ago
Joined: 2013-07-17 01:30
I like to use

I like to use [RegistryValueWrite] because I can copy the value exactly from Regedit and need not to add double quotation mark nor change single slash to double slash. It is easier to learn and it seems work as I want.

tony200910041
Offline
Last seen: 7 years 9 months ago
Joined: 2013-04-02 07:44
Ok. I finally use Type=INI

Ok. I finally use Type=INI and it was tackled.
So one last question: which kind of files I can use Type=ConfigWrite?

John T. Haller
John T. Haller's picture
Offline
Last seen: 5 hours 15 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
config files

They're used for config files. These are like INI files except they have no section names and don't necessarily use equal signs to delineate between key and value. You'll know it when you run across it.

Sometimes, the impossible can become possible, if you're awesome!

Log in or register to post comments