Quote:

Can i check errorlevel in some way after a SHELL call?




Yes, @ERROR is set to the exit value of the program called.

Quote:

And, can i set @ERROR myself in a function? If i create an UDF for example.




Yes. You will see that most UDFs exit by using "Exit n", when "n" is the value to set @ERROR to.

For example:
Code:
Function myUDF()
Exit 3
EndFunction



This will leave @ERROR set to 3. You should always set @ERROR when leaving a UDF, use "Exit 0" for success.

You can also set @ERROR in-line by using exit. To clear an error status:

$=Execute("Exit 0")