AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Loop, RootKey

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
sleepyy35



Joined: 22 Jul 2004
Posts: 194
Location: cedar city UT

PostPosted: Fri Jul 23, 2004 9:01 am    Post subject: Loop, RootKey Reply with quote

can i use Loop, RootKey to search the registry not sure i understand this cmd say i have 2 or 3 files in the registry to look for and del
is it the loop that i would use ?

michael AKA ^sleepy^









feed your mind Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Fri Jul 23, 2004 6:08 pm    Post subject: Reply with quote

I created the following script that should help. But while doing it, I discovered a bug that prevented an entire root key from being recursively searched. So be sure to download the latest version from http://www.autohotkey.com/download/ if you need to search the entire registry and all of its subkeys.

The below can be modified to use RegDelete when a key is found that you want to delete. However, use caution since such a script could easily destroy your registry if is not designed correctly.
Code:
; Recursively search the entire registry for particular value(s).
RegSearchTarget = WinZip  ; Tell the subroutine what to search for.
Gosub, RegSearch
return

RegSearch:
ContinueRegSearch = y
Loop, HKEY_LOCAL_MACHINE, , 1, 1
{
   Gosub, CheckThisRegItem
   if ContinueRegSearch = n ; It told us to stop.
      return
}
Loop, HKEY_USERS, , 1, 1
{
   Gosub, CheckThisRegItem
   if ContinueRegSearch = n ; It told us to stop.
      return
}
Loop, HKEY_CURRENT_CONFIG, , 1, 1
{
   Gosub, CheckThisRegItem
   if ContinueRegSearch = n ; It told us to stop.
      return
}
; Note: I believe HKEY_CURRENT_USER does not need to be searched if HKEY_USERS
; is being searched.  The same might also be true for HKEY_CLASSES_ROOT if
; HKEY_LOCAL_MACHINE is being searched.
return

CheckThisRegItem:
if A_LoopRegType = KEY  ; Remove these two lines if you want to check key names too.
   return
RegRead, RegValue
if ErrorLevel <> 0
   return
IfInString, RegValue, %RegSearchTarget%
{
   MsgBox, 4, , The following match was found:`n%A_LoopRegKey%\%A_LoopRegSubKey%\%A_LoopRegName%`nValue = %RegValue%`n`nContinue?
   IfMsgBox, No
      ContinueRegSearch = n
}
return


Since I'm thinking of adding the above example to the help file, does anyone know if the below comments are accurate?

Note: I believe HKEY_CURRENT_USER does not need to be searched if HKEY_USERS is being searched. The same might also be true for HKEY_CLASSES_ROOT if HKEY_LOCAL_MACHINE is being searched.

Edit: Fixed typo.


Last edited by Chris on Fri Jul 23, 2004 11:24 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
sleepyy35



Joined: 22 Jul 2004
Posts: 194
Location: cedar city UT

PostPosted: Fri Jul 23, 2004 8:29 pm    Post subject: Reply with quote

cool i will play with that for a while
thanx chris !!!!
_________________
^sleepy^
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
sleepyy35



Joined: 22 Jul 2004
Posts: 194
Location: cedar city UT

PostPosted: Sat Jul 24, 2004 9:57 am    Post subject: Reply with quote

chris i cant seem to get that script to work i been trying to fig it out but no luck
is the script working for you when it is ran it just kinda flashes on the screen and its gone .
_________________
^sleepy^
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
sleepyy35



Joined: 22 Jul 2004
Posts: 194
Location: cedar city UT

PostPosted: Sat Jul 24, 2004 11:02 am    Post subject: Reply with quote

i got it to work nice script i thought i had the update but not
sorry Confused i'm hanging with stupid lol

; Recursively search the entire registry for particular value(s).
RegSearchTarget = ; Tell the subroutine what to search for.

can i add a input box like this

RegSearchTarget = input, then the key or would ihave to do it like this

input, then the key and leaveing this out -RegSearchTarget =
and would it be posible to add more then one key to the search ?

it looks simple now i see how you script it like
HKEY_LOCAL_MACHINE, , 1, 1
then
HKEY_USERS, , 1, 1
etc

rather simple now that i been studying your script
pritty good thanx for the help Smile
_________________
^sleepy^
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group