Sign in to follow this  
Followers 0
Recce

If regkey exists - delete it [Solved]

9 posts in this topic

#1 ·  Posted (edited)

I need an input to do this script right (Yes I am a n00b).

Its a simple task. Read the registry (keys listed below) and delete all the keys that meet the criterias.

But it is a lot of keys and a lot of Criterias.

How can this be solved?

Using Case or If?

Any help is welcome!

:P

Keys:

RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\PFPS\FalconView\Custom Tools\Button1", "Path")

RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\PFPS\FalconView\Custom Tools\Button2", "Path")

RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\PFPS\FalconView\Custom Tools\Button3", "Path")

RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\PFPS\FalconView\Custom Tools\Button4", "Path")

RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\PFPS\FalconView\Custom Tools\Button5", "Path")

RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\PFPS\FalconView\Custom Tools\Button6", "Path")

RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\PFPS\FalconView\Custom Tools\Button7", "Path")

RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\PFPS\FalconView\Custom Tools\Button8", "Path")

RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\PFPS\FalconView\Custom Tools\Button9", "Path")

RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\PFPS\FalconView\Custom Tools\Button10", "Path")

Criterias

$1 = "C:\Pfps\MPU\GPX2SHP\GPX2SHP.exe"

$2 = "C:\Pfps\MPU\KML2SHP&GPX\KML2SHP&GPX.exe"

$3 = "C:\Pfps\MPU\LPT2GPX\LPT2GPX.exe"

$4 = "C:\Pfps\MPU\SHP2GPX\SHP2GPX.exe"

$5 = "C:\Pfps\MPU\TXT2LPT\TXT2LPT.exe"

Edited by Recce

Share this post


Link to post
Share on other sites



$1 = "C:\Pfps\MPU\GPX2SHP\GPX2SHP.exe"
$2 = "C:\Pfps\MPU\KML2SHP&GPX\KML2SHP&GPX.exe"
$3 = "C:\Pfps\MPU\LPT2GPX\LPT2GPX.exe"
$4 = "C:\Pfps\MPU\SHP2GPX\SHP2GPX.exe"
$5 = "C:\Pfps\MPU\TXT2LPT\TXT2LPT.exe"

For $i = 1 To 10
    $Tmp = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\PFPS\FalconView\Custom Tools\Button" & $i, "Path")
    If $Tmp <> ""
        Switch $Tmp
            Case $1
                ;Something
            Case $2
                ;Something
            Case $3
                ;Something
            Case $4
                ;Something
            case $5
                ;And... something ;]
        EndSwitch
    EndIf
Next

?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thank you Authenticity´!

Smart use Case and Switch (new to me)

But how can I implant this scenario:

1. Button 1 (or any button) is found to have criteria $3 (0r any criteria)

2. Button 1 is deleted using "RegDelete"

Edited by Recce

Share this post


Link to post
Share on other sites

You're reading only one value from each key so it's assumed that if the value of the value name |o| was matched and deleted you don't need to bother with ContinueCase or to check again. What it should be like? only "Path" is assumed to be matched?

Share this post


Link to post
Share on other sites

You're reading only one value from each key so it's assumed that if the value of the value name |o| was matched and deleted you don't need to bother with ContinueCase or to check

I agree!

What it should be like? only "Path" is assumed to be matched?

My question is how to implant "RegDelete" in the script.

How to know what button number to delete?

(Sorry if its a stupid question)

Share this post


Link to post
Share on other sites

The same $i:

$1 = "C:\Pfps\MPU\GPX2SHP\GPX2SHP.exe"
$2 = "C:\Pfps\MPU\KML2SHP&GPX\KML2SHP&GPX.exe"
$3 = "C:\Pfps\MPU\LPT2GPX\LPT2GPX.exe"
$4 = "C:\Pfps\MPU\SHP2GPX\SHP2GPX.exe"
$5 = "C:\Pfps\MPU\TXT2LPT\TXT2LPT.exe"
$sRegKey = "HKEY_LOCAL_MACHINE\SOFTWARE\PFPS\FalconView\Custom Tools\Button"

For $i = 1 To 10
    $Tmp = RegRead($sRegKey & $i, "Path")
    If $Tmp <> ""
        Switch $Tmp
            Case $1,$2,$3,$4,$5
                RegDelete($sRegKey & $i, "Path")
        EndSwitch
    EndIf
Next

?

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Thank you once again Authenticity !

But I must be implanting it wrong when AU3Check give me this:

>"C:\Programmer\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /prod /AU3Check /in "C:\MPU\Remove_ FV_buttons.au3"
+>18:36:38 Starting AutoIt3Wrapper v.1.10.1.14    Environment(Language:0406  Keyboard:00000406  OS:WIN_XP/Service Pack 3  CPU:X86  ANSI)
>Running AU3Check (1.54.14.0)  from:C:\Programmer\AutoIt3
C:\MPU\Remove_ FV_buttons.au3(22,18) : ERROR: multi-line 'If' missing 'Then'.
    If $Tmp <> ""
~~~~~~~~~~~~~~~~~^
C:\MPU\Remove_ FV_buttons.au3(27,5) : ERROR: missing Next.
    EndIf
~~~~^
C:\MPU\Remove_ FV_buttons.au3(20,12) : REF: missing Next.
For $i = 1 To
~~~~~~~~~~~^
C:\MPU\Remove_ FV_buttons.au3(27,5) : ERROR: syntax error
    EndIf
~~~~^
C:\MPU\Remove_ FV_buttons.au3 - 3 error(s), 0 warning(s)
!>18:36:38 AU3Check ended.rc:2
+>18:36:38 AutoIt3Wrapper Finished
>Exit code: 0    Time: 0.327
Edited by Recce

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Forgot to add the then, add "Then" after the If $Tmp <>.

Edit: I don't know why you get error that there is no corresponding Next to the For $i = 1 To 10, don't forget to add it as well.

Edited by Authenticity

Share this post


Link to post
Share on other sites

Forgot to add the then, add "Then" after the If $Tmp <>.

That did it!

I wish I had you brain Authenticity!

Thank you very very much!

:P

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0