PatrickdeGelder Posted April 30, 2019 Posted April 30, 2019 Using the example I build the script below: What i try to get done: Execute Function RunAsWait use password 1 when password is incorrect RunAsWait use password 2. But currently the script reports a msgbox on the first attempt: The username or password is incorrect. any tips? Func Setup() ; Username and password to the appropriate values for your system. Local $sUserName = "SystemAdmin" Local $sPassword1 = "Syst123!" Local $sPassword2 = "System123!" ; Run Cmd and wait for process to close. CMD is run under the user pecified. Local $ifirst = RunAsWait($sUserName, @ComputerName, $sPassword1, $RUN_LOGON_NOPROFILE, @ScriptDir & ".\AltirisSetup\EC_SMA.cmd", "", @SW_HIDE) If @error Then Local $iSecond = RunAsWait($sUserName, @ComputerName, $sPassword2, $RUN_LOGON_NOPROFILE, @ScriptDir & ".\AltirisSetup\EC_SMA.cmd", "", @SW_HIDE) Else Local $iSecond = -1 EndIf If @error Then Local $sLastError = _WinAPI_GetLastErrorMessage() MsgBox($MB_SYSTEMMODAL + $MB_ICONERROR, "Error", "Installation Failed Contact Administrator" & @CRLF & @CRLF & $sLastError) Else ; Display the return code of the process. MsgBox($MB_SYSTEMMODAL, "", "installation Successed. First:"& $ifirst &", Second:"& $iSecond) EndIf EndFunc ;==>Setup
Developers Jos Posted April 30, 2019 Developers Posted April 30, 2019 Welcome Patrick, No sure I understand completely what you are saying : Is the messagebox , you talk about, displayed by the shelled process or by AutoIt3? 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now