Sign in to follow this  
Followers 0
BoogY

Help with code

4 posts in this topic

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 ?

Share this post


Link to post
Share on other sites



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


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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

Share this post


Link to post
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

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