Jump to content

Why won't my script work?


Recommended Posts

Why won't this script work in a function:

$startup = 1

if $startup = 1 then

$temp = 1

$pass=inputbox("Password", "Password")

if $pass <> "autoit" then

msgbox(0, "Password","Incorrect Password")

$pass2=inputbox("Password", "Password")

if $pass2 <> "uhcakip" then

shutdown(4) else

sleep (10) elseif $error=1 then

shutdown(4)

endif

elseif $error=1 then

shutdown(4)

else

sleep (10)

endif

endif

[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Link to comment
Share on other sites

Why won't this script work in a function:

CODE

If $startup = 1 Then

  $temp = 1

  $pass = InputBox("Password", "Password")

  If $pass <> "autoit" Then

      MsgBox(0, "Password", "Incorrect Password")

      $pass2 = InputBox("Password", "Password")

      If $pass2 <> "uhcakip" Then

        Shutdown(4)

      Else

        Sleep(10)

      ElseIf $error = 1 Then

        Shutdown(4)

      EndIf

  ElseIf $error = 1 Then

      Shutdown(4)

  Else

      Sleep(10)

  EndIf

EndIf

You put the cart before the horse. You have an "else" in front of an "elseif"

Edit:Killa, you fast...............

Edited by Blue_Drache

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

Link to comment
Share on other sites

heres the full thing

func password()
$startup = 1
if $startup = 1 then
$temp = 1
$pass=inputbox("Password", "Password")
if $pass <> "autoit" then 
msgbox(0, "Password","Incorrect Password")
$pass2=inputbox("Password", "Password")
if $pass2 <> "uhcakip" then
shutdown(4) 
else
sleep (10) 
elseif $error=1 then
shutdown(4)
endif
elseif $error=1 then
shutdown(4)
else 
sleep (10)
endif
endif
end func
winwaitactive("Startup")
password()
Edited by fear1313

[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Link to comment
Share on other sites

I canged it but now it keeps saying there is no if statement for my endif

<{POST_SNAPBACK}>

CODE

$Startup = 1

If $startup = 1 Then

$temp = 1

$pass = InputBox("Password", "Password")

If $pass <> "autoit" Then

MsgBox(0, "Password", "Incorrect Password")

$pass2 = InputBox("Password", "Password")

If $pass2 <> "uhcakip" Then

msgbox(0,"","test")

ElseIf $error = 1 Then

msgbox(0,"","test")

Else

Sleep(10)

EndIf

ElseIf $error = 1 Then

msgbox(0,"","test")

Else

Sleep(10)

EndIf

EndIf

Works fine for me. Just crashes when it's looking for $error because the rest of the code's not here or you're forgetting to set it.

BTW, change the msgbox(0,"","test") back to your rebooting command.

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

Link to comment
Share on other sites

  • Developers

Here is the tidy output.... your have a "end func" which needs to be EndFunc.

Also review your logic now its indented..

Func password()
    $startup = 1
    If $startup = 1 Then
        $temp = 1
        $pass = InputBox("Password", "Password")
        If $pass <> "autoit" Then
            MsgBox(0, "Password", "Incorrect Password")
            $pass2 = InputBox("Password", "Password")
            If $pass2 <> "uhcakip" Then
                Shutdown(4)
            Else
                Sleep(10)
            ElseIf $error = 1 Then
                Shutdown(4)
            EndIf
        ElseIf $error = 1 Then
            Shutdown(4)
        Else
            Sleep(10)
        EndIf
    EndIf
    end Func
    WinWaitActive("Startup")
    password()
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

Did you try it in a function? Cause thats when it fs up

<{POST_SNAPBACK}>

CODE

bootit()

Func Bootit()

$Startup = 1

If $Startup = 1 Then

$temp = 1

$pass = InputBox("Password", "Password")

If $pass <> "autoit" Then

MsgBox(0, "Password", "Incorrect Password")

$pass2 = InputBox("Password", "Password")

If $pass2 <> "uhcakip" Then

MsgBox(0, "", "test")

ElseIf $error = 1 Then

MsgBox(0, "", "test")

Else

Sleep(10)

EndIf

ElseIf $error = 1 Then

MsgBox(0, "", "test")

Else

Sleep(10)

EndIf

EndIf

EndFunc ;==>Bootit

Yup. Works fine.

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

Link to comment
Share on other sites

  • Developers

Did you try it in a function? Cause thats when it fs up

<{POST_SNAPBACK}>

no need too... did you change the "end func" to "endfunc" ?

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

  • Developers

JdeB: Maybe he needs SciTE.  :lol::idiot:  :D

<{POST_SNAPBACK}>

yeap and start using Tidy... it really helps a lot with these kind of problems...

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