 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Jasdeep
Joined: 09 Nov 2009 Posts: 258
|
Posted: Fri Dec 18, 2009 2:10 pm Post subject: registry detect |
|
|
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 |
|
 |
Jasdeep
Joined: 09 Nov 2009 Posts: 258
|
Posted: Fri Dec 18, 2009 3:01 pm Post subject: |
|
|
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 |
|
 |
UncleScrooge
Joined: 14 Apr 2009 Posts: 75 Location: Italy
|
Posted: Fri Dec 18, 2009 4:04 pm Post subject: |
|
|
| 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 |
|
 |
Jasdeep
Joined: 09 Nov 2009 Posts: 258
|
Posted: Fri Dec 18, 2009 4:19 pm Post subject: |
|
|
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 |
|
 |
aaffe
Joined: 17 May 2007 Posts: 1002 Location: Germany - Deutschland
|
Posted: Fri Dec 18, 2009 4:54 pm Post subject: |
|
|
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 |
|
 |
Jasdeep
Joined: 09 Nov 2009 Posts: 258
|
Posted: Mon Dec 21, 2009 8:45 am Post subject: |
|
|
| thanks aaffe its working |
|
| Back to top |
|
 |
aaffe
Joined: 17 May 2007 Posts: 1002 Location: Germany - Deutschland
|
Posted: Mon Dec 21, 2009 8:53 am Post subject: |
|
|
| Youre Welcome. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|