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 

registry detect

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



Joined: 09 Nov 2009
Posts: 258

PostPosted: Fri Dec 18, 2009 2:10 pm    Post subject: registry detect Reply with quote

hi to all...in my below code i am trying to check whether the registry path exists or not but i am encountering some problem please have a look at it
Code:


RegSearchTarget =SOFTWARE\ETAS\ETKControlPanel\ ; I want to check whether this path exists or not
Gosub, RegSearch
return

RegSearch:
ContinueRegSearch = y
Loop, HKEY_LOCAL_MACHINE, , 1,1
{
   Gosub, CheckThisRegItem
   if ContinueRegSearch = n ; 
      return
}
return

CheckThisRegItem:
if A_LoopRegkey = KEY   
   return
RegRead, RegValue
if ErrorLevel <> 0
msgbox not present
   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

well actually the above path exists but still it says not present and no matter how many times you press the OK button on msgbox it never ends
your help is always appreciated
Back to top
View user's profile Send private message
Jasdeep



Joined: 09 Nov 2009
Posts: 258

PostPosted: Fri Dec 18, 2009 3:01 pm    Post subject: Reply with quote

well i tried with the following but at errorlevel no message is displayed
Code:

Loop, HKEY_LOCAL_MACHINE,SOFTWARE\ETAS\ETKControlPanel\,1
if errorlevel
   msgbox, does not exist.
else
   msgbox, The registry exists.

but in place of ETAS if i write some non existing folder it doesnt pops up the message,does not exist...why???
Back to top
View user's profile Send private message
UncleScrooge



Joined: 14 Apr 2009
Posts: 75
Location: Italy

PostPosted: Fri Dec 18, 2009 4:04 pm    Post subject: Reply with quote

Jasdeep wrote:
well i tried with the following but at errorlevel no message is displayed
Code:

Loop, HKEY_LOCAL_MACHINE,SOFTWARE\ETAS\ETKControlPanel\,1
if errorlevel
   msgbox, does not exist.
else
   msgbox, The registry exists.

but in place of ETAS if i write some non existing folder it doesnt pops up the message,does not exist...why???


because you dont loop at all... the condition to loop is initially FALSE (there is no registry path to loop through) so the command immediately following will never be executed, in this case the If/Else structure
_________________
Intel Centrino @ 2.8GHz
4 GB RAM
WIN XP SP3
Back to top
View user's profile Send private message AIM Address
Jasdeep



Joined: 09 Nov 2009
Posts: 258

PostPosted: Fri Dec 18, 2009 4:19 pm    Post subject: Reply with quote

well i did the following changes but still its giving wrong results
Code:

Loop, HKEY_LOCAL_MACHINE,SOFTWARE\ETAS,1
{
if errorlevel
{
 goto dd
}
else
{
   msgbox, The registry exists.
 }
 Return
}

gui,add,button,,OK
gui,show
Return


dd:
msgbox,4,, does not exist.
Return
Back to top
View user's profile Send private message
aaffe



Joined: 17 May 2007
Posts: 1002
Location: Germany - Deutschland

PostPosted: Fri Dec 18, 2009 4:54 pm    Post subject: Reply with quote

Loop, HKEY_LOCAL_MACHINE,SOFTWARE\ETAS -> If ETAS-Key isnt there, the loop will never run. So there will be no messagebox.
Try:
Code:
count=0
Loop, HKEY_LOCAL_MACHINE,SOFTWARE\ETAS,1
  count:=A_INDEX
if count=0
 msgbox,4,, does not exist.
else
   msgbox, The registry exists.

gui,add,button,,OK
gui,show
Return
Back to top
View user's profile Send private message
Jasdeep



Joined: 09 Nov 2009
Posts: 258

PostPosted: Mon Dec 21, 2009 8:45 am    Post subject: Reply with quote

thanks aaffe its working
Back to top
View user's profile Send private message
aaffe



Joined: 17 May 2007
Posts: 1002
Location: Germany - Deutschland

PostPosted: Mon Dec 21, 2009 8:53 am    Post subject: Reply with quote

Youre Welcome.
Back to top
View user's profile Send private message
Display posts from previous:   
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