Sign in to follow this  
Followers 0
Just_Plain_Cool

Losing It?

8 posts in this topic

Hello all...

I have two scripts that use exactly the same code to confirm that a user wants to exit the script. In both cases, the code is called as a subroutine. In one script, the code works fine. In the other, AutoIt is reporting "ERROR: syntax error

Func". I have even cut and pasted the code between the two scripts to no avail. Here is the code snippet. The first line is the Exit command from the main body of the script. It is called in multiple places in each script with "Confirm()".

Exit

Func Confirm()
$Confirm = MsgBox(1, "Confirm", "Do you want to exit?")
    If $Confirm = 1 Then
        Exit
    Else
    EndIf
EndFunc

Any ideas??? I'm stumped...

Thanks in advance,

Just Plain Cool :ph34r:

Share this post


Link to post
Share on other sites



Hi,

Try this

Exit

Func Confirm()
$Confirm = MsgBox(1, "Confirm", "Do you want to exit?")
    If $Confirm = 1 Then
        Exit
    EndIf
EndFunc

so without the else

Andre


What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel!

Share this post


Link to post
Share on other sites

Hi Andre,

Hmmm...that "else" used to be there for a reason, I can't believe I didn't notice it was still there when I looked at this code.

That being said, the error still exists after removing the "else". :(

Any other takers?

Thanks,

Just Plain Cool :ph34r:

Share this post


Link to post
Share on other sites

Hi,

Strange thing.

Are u using the v3.0.102 version ?

And search in your script that fails for confirm ?

Perhaps you have defind it double ?

Andre


What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel!

Share this post


Link to post
Share on other sites

Yes, I am using v3.0.102. And it is not in there twice. :ph34r:

Hi,

Strange thing.

Are u using the v3.0.102 version ?

And search in your script that fails for confirm ?

Perhaps you have defind it double ?

Andre

<{POST_SNAPBACK}>

Share this post


Link to post
Share on other sites

could you please post the Full failing code ?

Andre :ph34r:


What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel!

Share this post


Link to post
Share on other sites

could you please post the Full failing code ?

Andre :ph34r:

<{POST_SNAPBACK}>

Yeah. Because the script you posted in your first post should work fine.

Share this post


Link to post
Share on other sites

I found the error! The error actually occurred MUCH earlier in the code. I had added an If statement and then somehow, I put an Exit instead of an EndIf. The error message is odd and misplaced, but at least the mystery is solved.

Thanks for your help guys...

Just Plain Cool :ph34r:

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