if you end up writing a script to jump to a reg value, then this example may be of some help. i wrote it to grab (copy) reg paths from text files (from RegShot logs mainly) and open to the value, or as close as possible in case the value doesn't exist anymore. It for use with Registry Workshop (my reg editor of choice), but parts of it could be used with any other editor.
Registry Workshop offers command line options to jump directly to a specified key, but the script uses RegRead to first check if the subkey or value exists, and if not, to trim it to the closest existing subkey. i also just added a loop that reads the value names, sorts them, and sends the right number of key strokes based on that - it was a bit more convoluted than I had hoped because AHK retrieves them in some type of non-alphabetical reverse order.
the script works for the most part, but I haven't cleaned it up and there are parts I'm hoping to improve. the DllCall method mentioned by hd0202 may be the way to go (haven't tried it yet).
Code:
#NoEnv
#SingleInstance, Force
SetBatchLines, -1
DetectHiddenWindows, On
SetTitleMatchMode, 2
SendMode, Input
;the longer #q is pressed the more lines are selected
#q::
KeyWait, q, T0.5
Gosub, % oCB:= Errorlevel ? "OpenWithRegWkshp" : "RunRegWkshp"
loop % regPath0
regPath%A_Index%=
regPath0=
regPath=
exists=
rPath=
rPath1=
rPath2=
rPath3=
rPath4=
rPath5=
SelectedPath=
rNames=
Return
OpenWithRegWkshp:
FlashWin()
lines:=0
loop,
{
KeyWait, q, T0.3
If Errorlevel
{
FlashWin() ;select number of lines
lines++
}
Else Break
}
oCB:= ClipboardAll
Send, {Home}{ShiftDown}{Down %lines%}{End}{ShiftUp}^c
ClipWait, 2
StringSplit, regPath, Clipboard,`n,`r][%A_Space%
Clipboard:= oCB
RegExMatch(regPath1,"i)(HKLM|HKCR|HKCU|HKU|HKCC|HKEY_LOCAL_MACHINE|HKEY_USERS|HKEY_CURRENT_USER|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG)\\(?:((.*)\\(.*?)(?::\s)(.*)|.*))", rPath)
If (rPath1 = "") ;if no rootkey present, run editor without path
Goto, RunRegWkshp
If (rPath3 != "") ;If reg values available, check with AHK
{
rSteps:=0
RegRead, exists, %rPath1%, %rPath3%, %rPath4%
If !Errorlevel
{
SelectedPath:= rPath1 . "\" . rPath3
Loop %rPath1%,%rPath3%,2
rSteps++
If (rPath4 = "(Default)") || (rPath4 = "")
rPath4:= SelectedPath ;this is specific to regWksp
Else
{
Loop %rPath1%,%rPath3%
rNames.= A_LoopRegName . "`n"
StringTrimRight,rNames,rNames,1
Sort,rNames
Loop,Parse,rNames,`n
{
rSteps++
If (A_LoopField = rPath4)
Break
}
}
}
Else rPath4=
}
Else rPath3:= rPath2 ;update variable names to match
If SelectedPath =
{
loop,
{
values:=0
Loop %rPath1%, %rPath3%, 1 ; checks if key exists
values++
If (values > 0)
{
SelectedPath:= rPath1 . "\" . rPath3
Break
}
RegExMatch(rPath3,".*(?=\\)",rPath3)
}
}
IfWinExist, Registry Workshop
{
hRegWksp:= WinWaitFull("Registry Workshop")
ControlSetText,Edit1,%SelectedPath%, ahk_id %hRegWksp%
ControlFocus,Edit1,ahk_id %hRegWksp%
ControlSend,Edit1,{Enter},ahk_id %hRegWksp%
Sleep, 300
}
Else
{
Run, "%A_ProgramFiles%\Registry Workshop\RegWorkshop.exe" /g "%SelectedPath%"
hRegWksp:= WinWaitFull("Registry Workshop")
}
If rPath4
{
ControlFocus, ATL:0050C4901, ahk_id %hRegWksp%
Send {Left}{Down %rSteps%}
}
Return
RunRegWkshp:
IfWinExist, Registry Workshop
WinActivate
Else Run %A_ProgramFiles%\Registry Workshop\RegWorkshop.exe
Return
FlashWin(speed=10)
{
If speed < 2
speed:= 2
Gui, Color, FFFFFF
WinGet, thisID, ID, A
Loop, %speed%
{
tran:= 10*Abs( 25-(50/speed)*A_Index )+5
WinSet, Transparent, %tran%, ahk_id %thisID%
}
;WinSet, Transparent, Off, ahk_id %thisID%
}
WinWaitFull(win)
{
WinWait, %win%
If hWin:= WinExist( win )
{
IfWinNotActive, ahk_id %hWin%
WinActivate, ahk_id %hWin%
WinWaitActive, ahk_id %hWin%
Return hWin
}
Else Return 0
}