[a133] RegRead + Default when Path is not found Topic is solved

Report problems with documented functionality
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

[a133] RegRead + Default when Path is not found

06 May 2021, 07:53

If not a Bug, than a Wish for v2


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
Ref: https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed#net_d
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 21 guests