Jump to content
Sign in to follow this  
BillLuvsU

Why won't my script work?

Recommended Posts

BillLuvsU

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

Share this post


Link to post
Share on other sites
killaz219

im guessing it's the

Shutdown(4) Else
         Sleep(10) ElseIf $error = 1 Then

Share this post


Link to post
Share on other sites
Blue_Drache

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

Share this post


Link to post
Share on other sites
BillLuvsU

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


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

Share this post


Link to post
Share on other sites
BillLuvsU

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

Share this post


Link to post
Share on other sites
Blue_Drache

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

Share this post


Link to post
Share on other sites
Jos

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

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
BillLuvsU

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


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

Share this post


Link to post
Share on other sites
BillLuvsU

gtg


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

Share this post


Link to post
Share on other sites
Blue_Drache

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

Share this post


Link to post
Share on other sites
BillLuvsU

mail me


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

Share this post


Link to post
Share on other sites
Jos

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" ?

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Blue_Drache

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


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

Share this post


Link to post
Share on other sites
Jos

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

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
phillip123adams

   ElseIf $error = 1 Then

   ElseIf $error = 1 Then

<{POST_SNAPBACK}>

$error or @error?

Phillip

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  

×