Dealing with errors caused by external script
Forums
Hi,
I have a master script that calls smaller scripts using Client.RunIDEAScriptEx. Every now and then (and more often than I'd like), something has changed which causes one of the scripts to fail - often it is something to do with the source data, but not always.
I have a simple error handler in both master and called scripts to give me a message about what went wrong and stop running the script. The problem is, my master script just pops up a message which tells me the called script failed and then it keeps running. It seems like the master script doesn't recognise the problem as an actual error, so it just keeps going.
How do I get my master script to stop if the called script has an error?
Any help is greatly appreciated.
RegardsLaura
Hi Laura,
Hi Laura,
I tried playing with it again on V9 last night and couldn't get it to work. When I have a chance I will try and get an answer from one of the gurus at IDEA on how it should function. Until then using a text file is probably the only way around it.
Thanks
Brian
Sholmit, thanks for the
Sholmit, thanks for the solution but it seems you can only either send variables or receive them you can't seem to do both. So depending if you need to both send and recieve it still seems you would have to write the variables to a text file for one or the other direction.
I thought so too (and it also
I thought so too (and it also seems so from the description of the function: "Run another IDEAScript macro and return four variables to the caller."). But actually it works on both directions at the same time (even with a same variable - so you can use it like ByRef parameter).
The solution of a text file still will the best way when you have to deal with more then 4 variables.
Was glad to find it out, especially after all help I got from your forum, Brian!
Hi Laura and welcome to the
Hi Laura and welcome to the site.
There is a function called Client.RunIDEAScriptRV which is suppose to be able to return values from the second script. Per the IDEA 8.5 documentation:
Run another IDEAScript and return four variables to the caller. In order for values to be returned, the called script must assign the values back to the global constants arg1, arg2, arg3, and arg4, repsectively.
Unfortunately I can't seem to get it to work, I will have to check to see if the version 9 documentation is any better on this one.
Another option is to write a text file on your harddrive saying that the script failed, each time you return from a secondary script the main script tests to see if the text file exists and if it does it aborts the other tests. If you want to try this out let me know and I can help you with the code if you wish. I will also see if V9 has better documentation on using the Client.RunIDEAScriptRV function.