RegRead: what am I missing here? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
J Scott Elblein
Posts: 7
Joined: 21 Aug 2017, 05:19
Location: Chicago
Contact:

RegRead: what am I missing here?

21 Aug 2017, 05:30

Hi all,

Brand new to AHK, but not new to coding. I installed AHK to play with and already have run into an issue.

I'm just trying to read the value of a reg key, and it's coming back empty (I've confirmed there's in fact, a value in the actual registry key itself). I copied & pasted the exact RegRead code straight from the help file, changing only the key.

Here's the entire code in my file so far:

Code: Select all

#NoEnv
#Warn
SendMode Input
SetWorkingDir %A_ScriptDir%

RegRead, OutputVar, HKEY_LOCAL_MACHINE\SOFTWARE\Oracle\VirtualBox, InstallDir
MsgBox, Program files are in: %OutputVar%
then when I run it using SciTE4AutoHK (or even directly via a command prompt, the messagebox just shows no value returned? :crazy:

Running this on Windows 10 x64. Any ideas? Thought this lang was supposed to be almost n00b-proof? :P
Rindis
Posts: 213
Joined: 23 Dec 2013, 13:58
Location: Norway
Contact:

Re: RegRead: what am I missing here?

21 Aug 2017, 07:41

There is a small difference:

Code: Select all

RegRead, OutputVar, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion, ProgramFilesDir
RegRead, OutputVar, HKEY_LOCAL_MACHINE\SOFTWARE\Oracle\VirtualBox, InstallDir
See the comma after HKEY_LOCAL_MACHINE?
just me
Posts: 9457
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: RegRead: what am I missing here?

21 Aug 2017, 08:31

Hi Rindis,
RootKey\SubKey [v1.1.21+]
If RootKey is followed immediately by a slash (\), RootKey and SubKey are merged into a single parameter.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: RegRead: what am I missing here?

21 Aug 2017, 09:10

If the key and value exist I would have thought that your script would work.

Try this in SciTE4AutoHotkey and/or as a separate script:

Code: Select all

q:: ;test RegRead
RegRead, vFontName, HKEY_CURRENT_USER\Software\Microsoft\Notepad, lfFaceName
MsgBox, % vFontName
RegRead, vFontName, HKEY_CURRENT_USER, Software\Microsoft\Notepad, lfFaceName
MsgBox, % vFontName
return
Note also: what version of AutoHotkey are you using, in case it's a version before v.1.1.21.

[EDIT:] Cheers qwerty12, I had meant to mention about SetRegView. While trying to explain/present things carefully, things can slip your mind.
Last edited by jeeswg on 21 Aug 2017, 17:02, edited 1 time in total.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
qwerty12
Posts: 468
Joined: 04 Mar 2016, 04:33
Contact:

Re: RegRead: what am I missing here?  Topic is solved

21 Aug 2017, 09:23

Hi,

I don't have VirtualBox installed to test, but if your AutoHotkey is 32-bit and you're working with a 64-bit VirtualBox, you probably need to add SetRegView 64 before doing the RegRead.

EDIT:
(Or maybe SetRegView 32 if you're using a 64-bit AutoHotkey and VirtualBox is 32-bit) - err, not going to happen - VirtualBox relies on kernel drivers...

J Scott Elblein: You're welcome :-)
Last edited by qwerty12 on 21 Aug 2017, 12:18, edited 1 time in total.
Rindis
Posts: 213
Joined: 23 Dec 2013, 13:58
Location: Norway
Contact:

Re: RegRead: what am I missing here?

21 Aug 2017, 11:43

Just_me:

good point :-)
User avatar
J Scott Elblein
Posts: 7
Joined: 21 Aug 2017, 05:19
Location: Chicago
Contact:

Re: RegRead: what am I missing here?

21 Aug 2017, 12:09

@qwerty12

That was it, TY. :D

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: jaka1, mikeyww and 322 guests