Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
#err usage
#1
Hi, i am pretty new to all of this and had a question:
My macro crashes and ends when lef command throws error "point outside the window". This happens when focus switches from the app, where the macro is suppose to run, to other window. I've found the err command but trying to figure out how to use it. Basically what i want it to do is: whenever error occurs"point outside the window" it should goto G1, thing is i have a lot of lef messages through the code and i want one err statement to handle all of the possible errors coming from any of those lef commands. This is what i would basically want:

#err goto G1
lef ...
...
if (...)
goto something
..
lef..
lef..
end

something
lef ..
lef ..
if (...)
goto somethingelse
end

somethingelse
lef..
lef..
end

G1
;;come here when any lef throws the error

whats the correct coding? thankyou
#2
lef ...
...
err+ ;;come here when any lef throws the error
...
#3
thank you for reply, so this is what it would look like then?


lef ...
...
if (...)
goto something
..
lef..
lef..
end

something
lef ..
lef ..
if (...)
goto somethingelse
end

somethingelse
lef..
lef..
end

err+
;;come here when any lef throws the error


err+ has to be placed after all of the lef commands and it will catch all of the errors genereted by any of the lef?
#4
Yes.

err catches error generated in previous single statement.

err+ catches errors generated in all previous statements starting from beginning or nearest err-.

#err catches compiler errors and is rarely used.
#5
thank you!
#6
Is it possible that if it errors, is to give u a message saying which part of the macro is in error?

I have pretty much added err goto but sometimes, when a child window is not found, there are multiple dialog boxes, I dont know which one is not found.

Thanks!
#7
Use special variable _error. Example:

Code:
Copy      Help
act "Notepad"

act "Calc"

err+
,ErrMsg 0 _s.format("%s[][]in line:[][]%s" _error.description _error.line)
,


Forum Jump:


Users browsing this thread: 3 Guest(s)