Jump to content

@error and Opt('RunErrorsFatal', 0)


Recommended Posts

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
Link to comment
Share on other sites

  • Developers

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')

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

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
Link to comment
Share on other sites

  • Developers

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

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

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