Jump to content

Recommended Posts

Posted (edited)

Hello,

I am making a script that can change a password for a domain user.

The script works fine but now i want to make this line or Readonly of greyed out so the user cannot change the input.

Can anybody help me?

Global $IUser = GUICtrlCreateInput(@UserName, 241, 8, 159, 21)

Thanks

here is the whole script

#AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#AutoIt3Wrapper_AU3Check_Stop_OnWarning=Y

#include <AD.au3>

#include <ButtonConstants.au3>

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

#include <GuiConstants.au3>

; Open AD

_AD_Open()

; Enter user and password to change

#region ### START Koda GUI section ### Form=

Global $Form1 = GUICreate("Password App", 414, 124, 251, 112)

GUICtrlCreateLabel("Gebruikersnaam (voorbeeld: TimTol):", 8, 10, 231, 17)

GUICtrlCreateLabel("Nieuw password:", 8, 42, 121, 17)

Global $IUser = GUICtrlCreateInput(@UserName, 241, 8, 159, 21)

Global $IPassword = GUICtrlCreateInput("", 241, 40, 159, 21)

Global $BOK = GUICtrlCreateButton("Verander Password", 8, 72, 121, 33)

Global $BCancel = GUICtrlCreateButton("Cancel", 328, 72, 73, 33, BitOR($GUI_SS_DEFAULT_BUTTON, $BS_DEFPUSHBUTTON))

GUISetState(@SW_SHOW)

#endregion ### END Koda GUI section ###

While 1

Global $nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE, $BCancel

Exit

Case $BOK

Global $sUser = GUICtrlRead($IUser)

$sUser = _AD_SamAccountNameToFQDN($sUser)

Global $sPassword = GUICtrlRead($IPassword)

ExitLoop

EndSwitch

WEnd

; Set the password

Global $iValue = _AD_SetPassword($sUser, $sPassword)

If $iValue = 1 Then

MsgBox(64, "MCH Password App", "Password voor gebruiker '" & $sUser & "' succesvol veranderd")

ElseIf @error = 1 Then

MsgBox(64, "MCH Password App", "Gebruiker '" & $sUser & "' bestaat niet")

Else

MsgBox(64, "MCH Password App", "Fout '" & @error & "' Het password is niet veranderd." & @CRLF & @CRLF & "Let op!!! TEST TEST")

EndIf

; Close Connection to the Active Directory

_AD_Close()

Edited by sabhazi
Posted

to bad...

"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Password Reset Script\_AD_SetPassword.au3"

C:\Password Reset Script\_AD_SetPassword.au3 (17) : ==> Variable used without being declared.:

Global $IUser = GUICtrlCreateInput(@UserName, 241, 8, 159, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_READONLY))

Global $IUser = GUICtrlCreateInput(@UserName, 241, 8, 159, 21, BitOR(^ ERROR

>Exit code: 1 Time: 0.473

Posted

to bad...

"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Password Reset Script\_AD_SetPassword.au3"

C:\Password Reset Script\_AD_SetPassword.au3 (17) : ==> Variable used without being declared.:

Global $IUser = GUICtrlCreateInput(@UserName, 241, 8, 159, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_READONLY))

Global $IUser = GUICtrlCreateInput(@UserName, 241, 8, 159, 21, BitOR(^ ERROR

>Exit code: 1 Time: 0.473

You're missing an include, then.

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

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
  • Recently Browsing   0 members

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