AutoHotkey Community

It is currently May 27th, 2012, 12:40 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: registry detect
PostPosted: December 18th, 2009, 3:10 pm 
Offline

Joined: November 9th, 2009, 3:09 pm
Posts: 258
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 18th, 2009, 4:01 pm 
Offline

Joined: November 9th, 2009, 3:09 pm
Posts: 258
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???


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 18th, 2009, 5:04 pm 
Offline

Joined: April 15th, 2009, 12:05 am
Posts: 75
Location: Italy
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 18th, 2009, 5:19 pm 
Offline

Joined: November 9th, 2009, 3:09 pm
Posts: 258
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 18th, 2009, 5:54 pm 
Offline

Joined: May 17th, 2007, 12:07 pm
Posts: 1004
Location: Germany - Deutschland
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 21st, 2009, 9:45 am 
Offline

Joined: November 9th, 2009, 3:09 pm
Posts: 258
thanks aaffe its working


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 21st, 2009, 9:53 am 
Offline

Joined: May 17th, 2007, 12:07 pm
Posts: 1004
Location: Germany - Deutschland
Youre Welcome.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Leef_me, Ohnitiel, XstatyK and 15 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group