Jump to content

Help with code


BoogY
 Share

Recommended Posts

Hello there >_<

Ok i have a problem with this code:

Local $computerName

#include <GUIConstants.au3>

#Region ### START Koda GUI section ###
$frmMain = GUICreate("SMS Killer", 172, 158, 193, 125)
$btnDesactiver = GUICtrlCreateButton("Desactiver la permission", 8, 56, 153, 33, 0)
$btnActiver = GUICtrlCreateButton("Activer la permission", 8, 88, 153, 33, 0)
$computerName = GUICtrlCreateInput("", 8, 32, 153, 21)
$lblTFS = GUICtrlCreateLabel("TFS : ", 8, 8, 58, 17)
$lblMessage = GUICtrlCreateLabel("TFS :", 8, 128, 30, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $msg = GUIGetMsg()
    Switch $msg
        
        Case $msg = $btnDesactiver
            ;-----------------------
            if $computerName = "" Then
                MsgBox(0,"TFS ERROR", "Pas de numéro TFS",3)
            Else
                RegWrite("\\" & $computerName & "\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\Client\Client Components\Remote Control","Permission Required", "REG_DWORD","00000000")
            EndIf
            if @error = 1 Then 
                MsgBox(0,"KEY ERROR", "La clé de registre n'existe pas",3)
            EndIf
            ;----------------------
        Case $msg = $btnActiver
            ;-----------------------
            if $computerName = "" Then
                MsgBox(0,"TFS ERROR", "Pas de numéro TFS",3)
            Else
                RegWrite("\\" & $computerName & "\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\Client\Client Components\Remote Control","Permission Required", "REG_DWORD","00000001")
            EndIf
            if @error = 1 Then 
                MsgBox(0,"KEY ERROR", "La clé de registre n'existe pas",3)
            EndIf
            ;-----------------------
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

What am I doing wrong ?

Link to comment
Share on other sites

  • Developers

It would help when you tell us what your problem is.

Assume you are forgetting to read the content of the control with GuiCtrlRead() like in:

if $computerName = "" Then

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I dit it and still not working. It's not changing the KEY

#include <GUIConstants.au3>
#include <GuiConstantsEx.au3>


#Region ### START Koda GUI section ###
$frmMain = GUICreate("SMS Killer", 172, 158, 193, 125)
$btnDesactiver = GUICtrlCreateButton("Desactiver la permission", 8, 56, 153, 33, 0)
$btnActiver = GUICtrlCreateButton("Activer la permission", 8, 88, 153, 33, 0)
$computerName = GUICtrlCreateInput("", 8, 32, 153, 21)
$lblTFS = GUICtrlCreateLabel("TFS : ", 8, 8, 58, 17)
$lblMessage = GUICtrlCreateLabel("TFS :", 8, 128, 30, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
            
        Case $msg = $btnDesactiver
            desactiverSMS()
            
        case $msg = $btnActiver         
            activerSMS()
    EndSelect
WEnd

Func activerSMS()
    if GUICtrlRead($computerName) = "" Then
        MsgBox(0,"TFS ERROR", "Pas de numéro TFS",3)
    Else
        MsgBox(0,"KEY OK", "En train de changer la clé",3)
        RegWrite("\\" & $computerName & "\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\Client\Client Components\Remote Control","Permission Required", "REG_DWORD","00000001")
    EndIf
EndFunc

Func desactiverSMS()
    if GUICtrlRead($computerName) = "" Then
        MsgBox(0,"TFS ERROR", "Pas de numéro TFS",3)
    Else
        MsgBox(0,"KEY OK", "En train de changer la clé",3)
        RegWrite("\\" & $computerName & "\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\Client\Client Components\Remote Control","Permission Required", "REG_DWORD","00000000")
    EndIf
EndFunc
Link to comment
Share on other sites

OK I got it :::::::

HERE IS THE CODE i'm rely stupid:

#include <GUIConstants.au3>
#include <GuiConstantsEx.au3>


#Region ### START Koda GUI section ###
$frmMain = GUICreate("SMS Killer", 172, 158, 193, 125)
$btnDesactiver = GUICtrlCreateButton("Desactiver la permission", 8, 56, 153, 33, 0)
$btnActiver = GUICtrlCreateButton("Activer la permission", 8, 88, 153, 33, 0)
$computerName = GUICtrlCreateInput("", 8, 32, 153, 21)
$lblTFS = GUICtrlCreateLabel("TFS : ", 8, 8, 58, 17)
$lblMessage = GUICtrlCreateLabel("TFS :", 8, 128, 30, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
            
        Case $msg = $btnDesactiver
            desactiverSMS()
            
        case $msg = $btnActiver         
            activerSMS()
    EndSelect
WEnd



Func activerSMS()
    if GUICtrlRead($computerName) = "" Then
        MsgBox(0,"TFS ERROR", "Pas de numéro TFS",3)
    Else
        $comp = GUICtrlRead($computerName)
        MsgBox(0,"KEY OK", "En train de changer la clé",3)
        RegWrite("\\" & $comp & "\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\Client\Client Components\Remote Control","Permission Required", "REG_DWORD","00000001")
    EndIf
EndFunc

Func desactiverSMS()
    if GUICtrlRead($computerName) = "" Then
        MsgBox(0,"TFS ERROR", "Pas de numéro TFS",3)
    Else
        $comp = GUICtrlRead($computerName)
        MsgBox(0,"KEY OK", "En train de changer la clé",3)
        RegWrite("\\" & $comp & "\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\Client\Client Components\Remote Control","Permission Required", "REG_DWORD","00000000")
    EndIf
EndFunc
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...