Jump to content

errer when I enable more than 1 if statement


AntiVirusGuy
 Share

Recommended Posts

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

Link to comment
Share on other sites

  • Developers

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

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

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