Jump to content

How to manage errors with runasset


 Share

Recommended Posts

hello everybody

I want to start internet explorer with runasset, but I will like to test if the login and the password is correct before start runwait. I join my script

====================================================================

#include <GuiConstants.au3>

AutoItSetOption("TrayIconHide", 1)

LogIntra ()

If @error Then

Msgbox(0,"BAD Authentification ,Try Again.","")

LogIntra ()

Else

$exec= chr(34) & @ProgramFilesDir & "\Internet Explorer\IEXPLORE.EXE" & chr(34) & "http://intranet/home.asp"

RunWait($exec)

RunAsSet()

EndIf

Func LogIntra ()

Dim $LabelWin

$LabelWin="Authentification Personnalisée - Portail"

GuiCreate($LabelWin, 420, 150,(@DesktopWidth-420)/2, (@DesktopHeight-150)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Label_1 = GuiCtrlCreateLabel("Entrez votre Login Réseau :", 30, 20, 150, 30)

$Input_2 = GuiCtrlCreateInput("", 180, 20, 200, 20)

$Label_3 = GuiCtrlCreateLabel("Mot De Passe :", 30, 50, 190, 40)

$Input_4 = GuiCtrlCreateInput("", 180, 50, 200, 20,$ES_PASSWORD)

$Label_5 = GUICtrlCreateLabel("( Cette session prendra fin à la fermeture de Internet Explorer )",80,90,300,20)

;~ $Label_6 = GuiCtrlCreateAvi("Connexion.avi",50,30, 100, 32, 32, $ACS_AUTOPLAY)

$RUN = GUICtrlCreateButton("Ok",180,120,100,20) ;This in the Run button

$EXIT = GUICtrlCreateButton("Annuler",300,120,100,20) ;This causes the application to exit

GuiSetState()

GUICtrlSetState($Input_2,$GUI_FOCUS)

Do

$msg = GUIGetMsg()

Until $msg = $EXIT or $msg = $RUN

If $msg = $EXIT then Exit

If $msg = $RUN Then

WinWaitActive($LabelWin)

WinSetState($LabelWin,"",@SW_HIDE)

$Input_2=GUICtrlRead($Input_2)

$Input_4=GUICtrlRead($Input_4)

RunAsSet($Input_2,"domain",$Input_4)

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...