PDA

View Full Version : Default value when getting a registry Key


ChristianD
11-08-2005, 04:40 PM
Hi,

On SUF 6, on the Read From Registry action there was a field name "default value". This value was put on the variable when the registry value was not found.

IE: I try to read this value:

Key: HKLM\Software\MyProgram
Value: WindowPositionX

In suf, I set the default value to ie 615 so when first installing the program this key don't exist in the registry and thus the 615 value was used in the setup program.

http://img177.imageshack.us/img177/4397/suf600py.png
Where is this field and how to use it in SUF 7 ?

Now in Suf 7 this field has disappeared. How can I do the same thing:

does this is correct:
MyVar = 615
MyVar = Registry.GetValue("HKLM","Software\MyProgram","WindowPositionX",true);

So if the Value WindowPositionX doesn't exist in the registry, does the value 615 will be overwritten ?

Eagle
11-08-2005, 09:24 PM
Hi, if I understand..try this as an example lua script of actions:

MyVar = "615"; --set your default value
get_myvar = Registry.GetValue(HKEY_LOCAL_MACHINE, "Software\\My Application", "WindowPositionX", true);
if (get_myvar == "") then
--in theory does not exist, so create your default entry 'valuename' and 'value'
Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\My Application", "WindowPositionX", MyVar, REG_SZ);
end

hth

PS: Reccomend consulting the help file - examples from the related action
or when using the action wizard :yes

ChristianD
11-09-2005, 12:14 PM
It's a very long procedure. I have about 20 settings to read.

I prefered the old SUF 6 default value :(