 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
dinkosta
Joined: 28 Sep 2005 Posts: 37 Location: Pirot
|
Posted: Mon Mar 06, 2006 10:34 pm Post subject: RegDelete from ListView |
|
|
The script I'm trying to make should retrieve the values from specified registry keys and when I check a row the value from that row should be removed from the registry. Retrieving the values works OK, but the problem I have is how to delete a certain value from the registry. I have the following script that doesn't delete anything:
| Code: |
Gui, Add, ListView, vlvo x10 y40 w680 h500 checked, Path|Name|Data
Gui,add,button,grem,Remove
Loop,HKCU, Software\Microsoft\Internet Explorer\Main
{
RegRead, rvalmain
LV_Add("","HKCU\Software\Microsoft\Internet Explorer\Main",a_loopregname,rvalmain)
}
Loop,HKLM, Software\Microsoft\Internet Explorer\Main
{
if a_loopregname = Start Page
{
RegRead, rvalmsp
LV_Add("","HKLM\Software\Microsoft\Internet Explorer\Main",a_loopregname,rvalmsp)
}
}
LV_ModifyCol(1,"200")
LV_ModifyCol(2,"180")
LV_ModifyCol(3,"Autohdr")
Gui, Show
return
rem:
ControlGet,outv,list,checked,lvo
FokRed := LV_GetNext("c")
LV_GetText(DeleteLine, FokRed)
MsgBox, 8244, Delete Entry, Are you sure you want to delete `n%DeleteLine%?
IfMsgBox,Yes
{
LV_Delete(FokRed)
RegDelete, %a_loopregkey%,%a_loopregsubkey%,%DeleteLine%
}
Return
|
|
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Tue Mar 07, 2006 10:44 am Post subject: |
|
|
I didn't analyzed closely the last part of your code, but I see that in the rem part, you use %a_loopregkey% and %a_loopregsubkey%. These variables are not available outside the registry loop...
You should use the values put in the ListView to know to path to the value to delete. _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
dinkosta
Joined: 28 Sep 2005 Posts: 37 Location: Pirot
|
Posted: Tue Mar 07, 2006 9:38 pm Post subject: |
|
|
First of all, thank you for your reply PhiLho.
The script I posted is one of the many variations I tried, and I did try to use only %DeleteLine% with 'RegDelete' but that didn't work neither.
I also tried it with a context menu, but I had the same problem - deleting the selected entry from the registry.
Any further suggestions? |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Tue Mar 07, 2006 11:41 pm Post subject: |
|
|
If I read correctly the manual on RegDelete (didn't tried it yet), it wants the RootKey (HKCU, HKLM), the SubKey (remainder of path) and the ValueName.
So you should do something like:
LV_GetText(DeleteLine, FokRed, 1)
LV_GetText(valueName, FokRed, 2)
StringLeft rootKey, DeleteLine, 4
StringTrimLeft DeleteLine, DeleteLine, 5
RegDelete %rootKey%, %DeleteLine%, %valueName%
Warning: this is untested! Replace the RegDelete command by a MsgBox (escape commas) to be sure this is the right stuff you are about to delete... _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
kapege.de
Joined: 07 Feb 2005 Posts: 186 Location: Munich, Germany
|
Posted: Wed Mar 08, 2006 2:17 pm Post subject: |
|
|
RegDelete *.*
 _________________ Peter
Wisenheiming for beginners: KaPeGe (German only, sorry) |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Wed Mar 08, 2006 2:53 pm Post subject: |
|
|
Too easy...
And what is this dot anyway?
Naaah, make a recursive exploration of the registry, and if a random number is above a thresold, just delete the current key/value...
That's is annoying!  _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
dinkosta
Joined: 28 Sep 2005 Posts: 37 Location: Pirot
|
Posted: Wed Mar 08, 2006 10:25 pm Post subject: |
|
|
Thanks a lot, PhiLho.
I did a quick test with a dummy value inside the registry key and it worked. |
|
| Back to top |
|
 |
nodswal Guest
|
Posted: Tue Oct 17, 2006 9:49 am Post subject: completed code |
|
|
| can the completed code be posted |
|
| 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
|