Page 1 of 1

Script command to ignore script errors?

Posted: 17 Dec 2011 01:07
by ghost zero
Is there a script command to ignore script errors? Example, I want this script to go to T: drive and not popup an error message if the drive can't be found. Is it possible?

goto "T:\"

Re: Script command to ignore script errors?

Posted: 17 Dec 2011 01:47
by nas8e9
I don't think XYplorer's scripting has explicit error handling yet, but you could in this case precede the goto with exists like so:

Code: Select all

if exists("T:\") == 2 {
   goto "T:\";
}
else {
   status "Drive T: not available.";
}
Edited: missing closing semicolon after status added.

Re: Script command to ignore script errors?

Posted: 17 Dec 2011 12:21
by PeterH
If I understand the initial question right the answer must be "no"!
Because it's not a "script error"!

Script errors are illegal commands, wrong number of operands, non-paired braces, maybe division by 0, ...

Here a formally correct script command leads to an exceptional situation during execution of that command - a path cannot be resolved. That must be handled by the command - not by the script! So the possible solution would be an operand for the command telling it to quietly ignore errors. An analog example is the "confirm-"switch of the delete command.

So this request shouldn't go to expansion of scripting, but to expansion of explicit commands, like "goto" in this case.