Prevent Scripting Halt/Break on Error?
-
- Posts: 577
- Joined: 09 Nov 2011 20:20
- Location: USA
Prevent Scripting Halt/Break on Error?
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.
I've searched and I haven't seen a posting which indicates how to disable the scripting dialog from appearing.
Computer/Systems Background = Expert | Windows 10 Pro (64-Bit) | Dell Precision 7720
Re: Prevent Scripting Halt/Break on Error?
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?)
(I assume it's the return of some function in some situation?)
Win11 Pro 223H2 Gerrman
-
- Posts: 577
- Joined: 09 Nov 2011 20:20
- Location: USA
Re: Prevent Scripting Halt/Break on Error?
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.
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 );
Computer/Systems Background = Expert | Windows 10 Pro (64-Bit) | Dell Precision 7720
Re: Prevent Scripting Halt/Break on Error?
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} *"
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} *"
Win11 Pro 223H2 Gerrman
-
- Posts: 577
- Joined: 09 Nov 2011 20:20
- Location: USA
Re: Prevent Scripting Halt/Break on Error?
Thanks for the information thus far PeterH! Greatly appreciated.
Not sure why this isn't a "scripting" issue and not looking to split hairs either.
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.
Saying something like, what?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.
Not sure why this isn't a "scripting" issue and not looking to split hairs either.
Because that's not the actual code, but represents the scripting command line to address the problem.PeterH wrote:By the way, for lazy people like me: why not simply "{Deprecated} *"
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.
Computer/Systems Background = Expert | Windows 10 Pro (64-Bit) | Dell Precision 7720
Re: Prevent Scripting Halt/Break on Error?
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.Zardoz2293 wrote:Not sure why this isn't a "scripting" issue and not looking to split hairs either
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.
Win11 Pro 223H2 Gerrman
-
- Posts: 577
- Joined: 09 Nov 2011 20:20
- Location: USA
Re: Prevent Scripting Halt/Break on Error?
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?PeterH wrote: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.Zardoz2293 wrote:Not sure why this isn't a "scripting" issue and not looking to split hairs either
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.
Computer/Systems Background = Expert | Windows 10 Pro (64-Bit) | Dell Precision 7720
Re: Prevent Scripting Halt/Break on Error?
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 toq&a bugreports.
(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
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
-
- Posts: 577
- Joined: 09 Nov 2011 20:20
- Location: USA
Re: Prevent Scripting Halt/Break on Error?
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.
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.
Computer/Systems Background = Expert | Windows 10 Pro (64-Bit) | Dell Precision 7720
Re: Prevent Scripting Halt/Break on Error?
That's right.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 toq&abugreports.
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.
Win11 Pro 223H2 Gerrman
-
- Posts: 577
- Joined: 09 Nov 2011 20:20
- Location: USA
Re: Prevent Scripting Halt/Break on Error?
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)?
Computer/Systems Background = Expert | Windows 10 Pro (64-Bit) | Dell Precision 7720
-
- Site Admin
- Posts: 60595
- Joined: 22 May 2004 16:48
- Location: Win8.1 @100%, Win10 @100%
- Contact:
Re: Prevent Scripting Halt/Break on Error?
You cannot suppress error messages in scripting.
FAQ | XY News RSS | XY Twitter
Re: Prevent Scripting Halt/Break on Error?
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.admin wrote:You cannot suppress error messages in scripting.
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.)
Win11 Pro 223H2 Gerrman