1) RegRead without Default throws an Error when the key or value is not found
-> Works like expected
2) RegRead with Default returns "Default value" when the key or value is not found
-> Works like expected
3) RegRead with Default throws an Error when the path incl. key and value is not found
-> should it not throw also the "Default value"?
Because when the Path is not found (e.g. at the top of my script) I can then set a path with key and value with RegWrite (e.g. later or with OnExit)
OT:
while playing with regread and different Dot.NET Versions I found a slower but interesting way to handle these (maybe someone else did this kind of switch/case before)
Code: Select all
Release := RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full", "Release", "")
MsgBox Release
Switch (true)
{
Case (Release >= 528040): ReleaseKey := "4.8 or later"
Case (Release >= 461808): ReleaseKey := "4.7.2"
Case (Release >= 461308): ReleaseKey := "4.7.1"
Case (Release >= 460798): ReleaseKey := "4.7"
Case (Release >= 394802): ReleaseKey := "4.6.2"
Case (Release >= 394254): ReleaseKey := "4.6.1"
Case (Release >= 393295): ReleaseKey := "4.6"
Case (Release >= 379893): ReleaseKey := "4.5.2"
Case (Release >= 378675): ReleaseKey := "4.5.1"
Case (Release >= 378389): ReleaseKey := "4.5"
Default: ReleaseKey := "No 4.5 or later version detected"
}
MsgBox ReleaseKey