Page 1 of 1
Prevent Scripting Halt/Break on Error?
Posted: 24 Jan 2015 00:04
by Zardoz2293
I wrote a complex folder/file rename script years ago and it worked perfectly. Now my error trapping doesn't work as XY throws the Scripting Error dialog/window on the screen rather than what it once did which was provide an empty string which I knew was an error and processed it as an error.
I've searched and I haven't seen a posting which indicates how to disable the scripting dialog from appearing.
Re: Prevent Scripting Halt/Break on Error?
Posted: 24 Jan 2015 00:20
by PeterH
Maybe an example of the error situation could help a bit to understand this?
(I assume it's the return of some function in some situation?)
Re: Prevent Scripting Halt/Break on Error?
Posted: 24 Jan 2015 00:43
by Zardoz2293
The script command below throws the error "The process cannot access the file because it is being used by another process." dialog. I trap all errors in the code so a dialog telling me there's an error is not wanted at "run time" when I'm using the script, when debugging, yes, otherwise no.
The cause is one of the files in the folder is currently in use and originally $Folder would return an empty string on an error and process accordingly.
Code: Select all
$Folder = renameitem( "{Deprecated} " . "*", $Folder );
Re: Prevent Scripting Halt/Break on Error?
Posted: 24 Jan 2015 01:17
by PeterH
OK: help talks about "name collision", but not about "access collision"

- so Don must say something.
But as I thought: this probably will be about renameitem(), not generally about scripting.
By the way, for lazy people like me: why not simply "{Deprecated} *"

Re: Prevent Scripting Halt/Break on Error?
Posted: 24 Jan 2015 01:35
by Zardoz2293
Thanks for the information thus far PeterH!
Greatly appreciated.
PeterH wrote:OK: help talks about "name collision", but not about "access collision"

- so Don must say something.
But as I thought: this probably will be about renameitem(), not generally about scripting.
Saying something like, what?
Not sure why this isn't a "scripting" issue and not looking to split hairs either.
PeterH wrote:By the way, for lazy people like me: why not simply "{Deprecated} *"

Because that's not the actual code, but represents the scripting command line to address the problem.
So we are saying what? Can't turn off the error/debug window at normal execution for all errors, now (since what release)? Tested the entire script for all conditions of errors on 2012-02-23. It's in the past month or two where I've had this condition occur with ever frequency. It would be nice to know what can be done to resolve so the script can execute smoothly without halting.
Re: Prevent Scripting Halt/Break on Error?
Posted: 24 Jan 2015 12:04
by PeterH
Zardoz2293 wrote:Not sure why this isn't a "scripting" issue and not looking to split hairs either
I think I can explain: the reaction on a "problem" seen by the function is
programmed into that function. (OK: there
can be exceptions.) So if Don will change something here he probably has to change this function, nothing about the scripting engine itself. And to know this he must exactly know about the error that occured - so I pre-asked.
Compare: the handling of this subroutine for "name collision". It also is just an internal of the routine, and so is described with it, not with scripting in general.
It may be not of interest for you - but at least it is for Don. Without knowing this he is unable to help.
Re: Prevent Scripting Halt/Break on Error?
Posted: 25 Jan 2015 06:33
by Zardoz2293
PeterH wrote:Zardoz2293 wrote:Not sure why this isn't a "scripting" issue and not looking to split hairs either
I think I can explain: the reaction on a "problem" seen by the function is
programmed into that function. (OK: there
can be exceptions.) So if Don will change something here he probably has to change this function, nothing about the scripting engine itself. And to know this he must exactly know about the error that occured - so I pre-asked.
Compare: the handling of this subroutine for "name collision". It also is just an internal of the routine, and so is described with it, not with scripting in general.
It may be not of interest for you - but at least it is for Don. Without knowing this he is unable to help.
PeterH, so what exactly do you believe is "missing" from my second posting to this thread which would prevent solving the problem so I can expand on the details?
Re: Prevent Scripting Halt/Break on Error?
Posted: 25 Jan 2015 07:04
by bdeshi
Peter didn't ask for anything more in his latest post here, he was just explaining something
(that something being "why this is not a problem with the whole scripting engine" (and he said that in the first place because of the way you titled the topic (a more fitting title would be "SC renameitem() fails on locked files")))
btw, moved to q&a bugreports.
Re: Prevent Scripting Halt/Break on Error?
Posted: 25 Jan 2015 09:26
by Zardoz2293
Actually my posting was correct under the scripting forum. If I was told there was/is a way to prevent scripting from throwing the error dialog I could prevent the renameitem() and any other potential future related (either bugs or by design). Where do I imply it's a problem with the whole scripting engine?
The reality is the correct answer to my question is apparently "You cannot, as an end-user, configure/prevent the scripting error dialog from popping in all cases" and apparently the answer is No.
Re: Prevent Scripting Halt/Break on Error?
Posted: 25 Jan 2015 12:07
by PeterH
SammaySarkar wrote:Peter didn't ask for anything more in his latest post here, he was just explaining something
(that something being "why this is not a problem with the whole scripting engine" (and he said that in the first place because of the way you titled the topic (a more fitting title would be "SC renameitem() fails on locked files")))
btw, moved to q&a bugreports.
That's right.
But it *also* is about giving info when reporting about some problem.
The next doesn't apply especially to this situation - it's general, with this situation just as an example!
I think we've learned that the problem here lies in a function. And to think about it we must know this! Because, as long as we don't talk about this function, we don't talk about this problem!
So, in general: report scripting errors always with (excerpt from) the script showing the problem.
My first post was to get this info for the current topic, my further posts were more in general, as I often see problems reported, without really specifying the situation where the problem occured.
The last, on topic again: this *might* be a bug. But maybe it's just a wish. As this situation doesn't seem to be documented, we can't know this. At the end Don might say: "can't / will not change!" - so we must wait for him to give info.
Re: Prevent Scripting Halt/Break on Error?
Posted: 29 Mar 2015 04:01
by Zardoz2293
SC renameitem throws "The process cannot access the file because it is being used by another process." error message during execution. What is the workaround to either prevent the XY scripting dialog from being displayed (when this event occurs)?
Re: Prevent Scripting Halt/Break on Error?
Posted: 08 Apr 2015 10:06
by admin
You cannot suppress error messages in scripting.
Re: Prevent Scripting Halt/Break on Error?
Posted: 08 Apr 2015 10:29
by PeterH
admin wrote:You cannot suppress error messages in scripting.
Hm - this was the reason why I posted it as a
wish in the thread "Scripting Command to Prevent Scripting Error Dialog Disp", on 29.3.2015, 12:45.
Though I'm aware that it sounds like 'some work' for you.
(And no: I don't see it as a bug. Just something where the scripter should have more control.)