Sign in to follow this  
Followers 0
AntiVirusGuy

errer when I enable more than 1 if statement

3 posts in this topic

Why am I getting an error when I enable more than 1 if statement if I un rem out more than 1 entry I get an error. I also can not get the runasset command to work even though I can do a runas in the os but that is another issues

#include <GUIConstants.au3>

;Generated with Form Designer preview

$Form1 = GUICreate("CSC Admin Launcher......or not", 576, 135, 192, 125, -1, BitOR($domain = GUICtrlCreateCombo("Colbys", 296, 20, 89, 21)

GUICtrlSetData(-1,"Local","Colbys")

$program = GUICtrlCreateCombo("Explorer", 416, 20, 145, 21)

GUICtrlSetData(-1,"Command|Control Panel|Internet Explorer|Other","Explorer")

GUICtrlCreateLabel("User", 8, 0, 43, 20)

GUICtrlCreateLabel("password", 160, 0, 48, 20)

GUICtrlCreateLabel("Domain", 296, 0, 43, 20)

GUICtrlCreateLabel("Program", 416, 0, 43, 20)

$username = GUICtrlCreateInput("", 8, 20, 121, 21, -1, $WS_EX_CLIENTEDGE)

$password = GUICtrlCreateInput("", 160, 20, 113, 21, $ES_PASSWORD,$WS_EX_CLIENTEDGE)

$oprogram = GUICtrlCreateInput("", 8, 56, 553, 21, -1, $WS_EX_CLIENTEDGE)

GUICtrlSetState(-1,$GUI_ACCEPTFILES)

$launch = GUICtrlCreateButton("Launch", 416, 88, 145, 25)

GUISetState()

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $launch

$rusername = GUICtrlRead($username)

$rpassword = GUICtrlRead($password)

$rdomain = GUICtrlRead($domain)

$rprogram = GUICtrlRead($program)

$roprogram = GUICtrlRead($oprogram)

RunAsSet($rusername, $rdomain, $rpassword)

;If $rprogram = "command" Then

;Run(@ComSpec & " /c " & 'cmd', "")

If $rprogram = "explorer" Then

Run(@ComSpec & " /c " & 'explorer', "",@SW_Hide)

EndIf

RunAsSet()

EndSelect

WEnd

GUIDelete()

Exit

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

It helpd it you indenet the code properly and you could run Tidy to fix it for you and tell you what is wrong when you cannot figure it out yourself.

This is the output from tidy:

#include <GUIConstants.au3>
;Generated with Form Designer preview

$Form1 = GUICreate("CSC Admin Launcher......or not", 576, 135, 192, 125, -1, BitOR($domain = GUICtrlCreateCombo("Colbys", 296, 20, 89, 21)
GUICtrlSetData(-1, "Local", "Colbys")
$program = GUICtrlCreateCombo("Explorer", 416, 20, 145, 21)
GUICtrlSetData(-1, "Command|Control Panel|Internet Explorer|Other", "Explorer")

GUICtrlCreateLabel("User", 8, 0, 43, 20)
GUICtrlCreateLabel("password", 160, 0, 48, 20)
GUICtrlCreateLabel("Domain", 296, 0, 43, 20)
GUICtrlCreateLabel("Program", 416, 0, 43, 20)
$username = GUICtrlCreateInput("", 8, 20, 121, 21, -1, $WS_EX_CLIENTEDGE)
$password = GUICtrlCreateInput("", 160, 20, 113, 21, $ES_PASSWORD, $WS_EX_CLIENTEDGE)
$oprogram = GUICtrlCreateInput("", 8, 56, 553, 21, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetState(-1, $GUI_ACCEPTFILES)

$launch = GUICtrlCreateButton("Launch", 416, 88, 145, 25)
GUISetState()

While 1
    $msg = GUIGetMsg()
    
    
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $launch
            $rusername = GUICtrlRead($username)
            $rpassword = GUICtrlRead($password) 
            $rdomain = GUICtrlRead($domain) 
            $rprogram = GUICtrlRead($program) 
            $roprogram = GUICtrlRead($oprogram)
            RunAsSet($rusername, $rdomain, $rpassword)
            If $rprogram = "command" Then
                Run(@ComSpec & " /c " & 'cmd', "")
                If $rprogram = "explorer" Then
                    Run(@ComSpec & " /c " & 'explorer', "", @SW_HIDE)
                EndIf
                RunAsSet()
;### Tidy Error: Level error -> EndSelect is closing previous Case
        EndSelect
        
;### Tidy Error: Level error -> WEnd is closing previous Select
    WEnd
    GUIDelete()
    
    Exit
Edited by JdeB

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

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