Archive: Variable losing a character when retrieving


Variable losing a character when retrieving
I am having some trouble with a variable.
Basically, I'm storing a code in a variable.
Inconsistantly it will drop the last character of the code when writing it back into the registry.
Any ideas? Am I supposed to pass it some space to store in or something?



; Var to store Activation code in for upgrading app
Var ACTIVATION




; Read activation and store for later
${PPC-registry::Read} "HKEY_LOCAL_MACHINE\Software\MyApp\" "Activation" $R6 $R7
StrCpy $ACTIVATION $R6



; Write activation code back into registry
${PPC-registry::Write} "HKEY_LOCAL_MACHINE\Software\MyApp\" "Activation" "$ACTIVATION" "REG_SZ" $R0
${If} $R0 == "0"
;MessageBox MB_OK "Success in writing activation"
${ElseIf} $R0 == "-1"
MessageBox MB_OK "Failed to write activation code!"
${EndIf}


Thanks if anyone can help.
Is there a better way to store and write information?

Are you sure that the value is stored properly in registry before the execution of your script?
Did you try to debug the script with message boxes to verify that on 1st step the plugin reads the correct value, on 2nd step that the value is stored in the $ACTIVATION variable and so on?
Also to manage the string as expand?


Hi Red Wine,

I have put debug statements before each of the code excerpts posted previously.

At each point, the entire code is in tact. At no point is the value stored in $ACTIVATION not what it should be.

I think the problem is in the way it is written, I was just thinking that maybe it needs some time to write? I could try making it wait for a second after the write command is called.

But apart from that, i may have to store it in halves and then run a check to confirm it was written correctly.

Thanks.


May I ask why you have to use this plugin here. Will Read/WriteRegStr not do?

Stu


Am I able to use that for a Windows Mobile PDA? Is it the PPC-Registry plugin you are asking about?


Ah I see you have to use the plugin. You should contact the plugin author.

Stu