Sign in to follow this  
Followers 0
Athfar

@error not working right?

2 posts in this topic

If WinExists("Save PDF File As", "&Yes") Then           

            If $overwrite_file == 1 Then
                MsgBox(1,"True","Should click Yes")
            ;ControlClick("Save PDF File As", "&Yes", "Button1")
            ElseIf $overwrite_file == 0 Then
                MsgBox(1,"No","Should click No")
                ControlClick("Save PDF File As", "&Yes", "Button2")
            Else 
                MsgBox(52,"Error","A file already exists! Do you wish to force overwrite for all files?")
                If @error == 6 Then
                    $overwrite_file = 1
                    MsgBox(1,"True","Should click Yes")
                ;ControlClick("Save PDF File As", "&Yes", "Button1")
                Else
                    $overwrite_file = 0
                    MsgBox(1,"No","Should click 1No")
                ;ControlClick("Save PDF File As", "&Yes", "Button2")
                EndIf
            EndIf
            
        EndIf

Why is it when I hit Yes for MsgBox(52,"Er.... it doesn't make @error 6 thus setting $overwrite_file = 1?

Share this post


Link to post
Share on other sites



If you see the help file, you'll see that MsgBox() doesn't set any value to @error. This is how it works.

$Ans=MsgBox(52, "Error", "A file already exists! Do you wish to force overwrite for all files?")
        If $Ans == 6 Then

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