Rajat
Joined: 28 Mar 2004 Posts: 1717
|
Posted: Wed Apr 21, 2004 2:02 am Post subject: Registry to AHK Script Convertor |
|
|
Just open regedit, rt. click a key and select 'copy key name'. run this script and paste key name when prompted. a file named 'reg.ahk' will be created in script's folder that'll recreate the whole registry key on the system its run on.
| Code: | SetBatchLines, 50ms
InputBox, regpath, Enter Registry Path, Enter registry path to create AutoHotkey Script`, in the format:`n`nHKEY_CURRENT_USER\Software\TEST_APP`n%a_tab%%a_tab%OR`nHKEY_CURRENT_USER\\Software\\TEST_APP`n`n
ifequal, regpath,, exitapp
MsgBox, 4, Dynamic Registry?, Do you want the script to have Dynamic Registry?`n`nEg. Paths pointing to your windows folder will be converted to user's windows folder when they run the generated script.
IfMsgbox, yes, setenv, Dynamic, Yes
FileDelete, %A_ScriptDir%\reg.ahk
StringReplace, regpath, regpath, \\, \, A
StringGetPos, spos, regpath, \
StringLeft, Key, regpath, %spos%
spos ++
StringTrimLeft, SubKey, regpath, %spos%
Loop, %key%, %subkey%, 1, 1
{
RegRead, A_Value
StringReplace, A_Value, A_Value, `n, ``n, A
StringReplace, A_Value, A_Value, `%, ```%, A
StringReplace, A_Value, A_Value, `,, ```,, A
StringReplace, A_Name, A_LoopRegName, `%, ```%, A
StringReplace, A_Name, A_Name, `,, ```,, A
IfEqual, Dynamic, Yes
{
StringReplace, A_Value, A_Value, %programfiles%, `%programfiles`%, A
StringReplace, A_Value, A_Value, %windir%, `%windir`%, A
StringReplace, A_Value, A_Value, %comspec%, `%comspec`%, A
StringReplace, A_Value, A_Value, %CommonProgramFiles%, `%CommonProgramFiles`%, A
StringReplace, A_Value, A_Value, %HOMEPATH%, `%HOMEPATH`%, A
StringReplace, A_Value, A_Value, %USERPROFILE%, `%USERPROFILE`%, A
StringReplace, A_Value, A_Value, %TEMP%, `%TEMP`%, A
}
IfNotEqual, A_LoopRegType, KEY, FileAppend, Regwrite`, %A_LoopRegType%`, %A_LoopRegKey%`, %A_LoopRegSubKey%`,%A_Name%`,%A_Value%`n, %A_ScriptDir%\reg.ahk
} |
_________________

Last edited by Rajat on Wed Apr 21, 2004 10:18 am; edited 1 time in total |
|