Sign in to follow this  
Followers 0
autoitNOW

@error and Opt('RunErrorsFatal', 0)

5 posts in this topic

#1 ·  Posted (edited)

Hi, I'm confused about how to get Opt('RunErrorsFatal', 0) and @error to work properly with autoit. I looked at the help and did a search, put there seems to be confusion.

I want to use the Run command. If an error occurs than I want to run a different program.

Opt ("RunErrorsFatal", 0);1=fatal, 0=silent set @error is in the script

Run "A"

If @error then Run "B"

My problem is that if Opt ("RunErrorsFatal", 1) than the script stops and an error message pops up

If I have Opt ("RunErrorsFatal", 0) than the script gives no errors and continues but program "B" is never run, but by itself program "B" runs fine.

Thanks in advance...

Can anyone tell me how this issue can be corrected?

Edited by autoitNOW

An ADVOCATE for AutoIT

Share this post


Link to post
Share on other sites



The below works fine for me....

Do you have another command between Run(..) and If @error statements ?

Opt ("RunErrorsFatal", 0);
run("thisdoesnotexit.exe")
if @error then msgbox(0,'error','error')

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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Opt ("RunErrorsFatal", 0);
run("thisdoesnotexit.exe")
if @error then msgbox(0,'error','error')
Opt ("RunErrorsFatal", 0);

RunAsSet ( "user", "password")

run("A.exe")

if @error then run("B.exe")

exit

Only difference is that I want to run another .exe as oppose to a msgbox. Also wanted to verify that this is the correct way to use @error and Opt ("RunErrorsFatal...

Edited by autoitNOW

An ADVOCATE for AutoIT

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Opt ("RunErrorsFatal", 0);

RunAsSet ( "user", "password")

run("A.exe")

if @error then run("B.exe")

exit

Only difference is that I want to run another .exe as oppose to a msgbox.  Also wanted to verify that this is the correct way to use @error and Opt ("RunErrorsFatal...

Understand what you are saying ... just wanted to show how it should work.

Yes this is the correct way. It will have an Error condition when either the file doesn't exist or the New Credentials fail to login.

Edited by JdeB

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

Share this post


Link to post
Share on other sites

I was being silly with @SW_HIDE and CMD/c in the Run statement of the script I was playing with, so I was not getting the result that I wanted. When I checked in the help and searched the site, I saw some different examples so I got a bit confused. Thanks for setting me straight.


An ADVOCATE for AutoIT

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