epuser
September 24, 2010, 8:54am
1
Hi,
i have the following set up
RunWithNewResults “master”
RunWithNewResults “exit”
//In master script
subscript1
subscript2
when subscript1 failes ,the controls goes to exit script.
I want subscript 2 to execute.I dnt want to create a new result file for subscripts.these results should come with master scripts results.i dont want to use runwithnewresults command,as it will create a new result file for all the subscripts.using Run command doesnt seem to work.Any other option?
Thanks for ur replies
If you want the results of subScript2 to be logged with the output of subscript2, then you’ll want to modify master.script to look like this:
try
// current contents of master script
catch
//if the master script code fails at any point, execution resumes here
subScript2
end try
If the output of script2 doesn’t matter that much, then you can do this:
runWithNewResults "Master"
put the result into outcome
if the status of outcome is "Failure" then
subScript2
end if
I hope one of these options will work for you.
epuser
September 30, 2010, 2:00pm
3
Thanks for the reply,
I already have this try and catch block.But the problem is :
If a script calls multiple subscripts then having try n catch for each subscript will increase the number of lines of code.
RunWithNewResults a;
//Inside a
try
run a.1
run a.2
run a.3
catch
//error if a.1 fails ,then execute a.2 .if a.2 fails run a.3 //dnt want to do this way
end try
2nd option:
try
run a.1
catch
error
end try
try
run a.2
catch
error
end try
try
run a.3
catch
error
end try
Dont think any of the above mentioned options will be useful.
only way is to use RunwithNewResults??
The only intention is not to create a new result file for every subscript.
Why do you have an issue with how many lines of code there are? The second option seems to cover what you’re asking for. Why is it not useful?
epuser
September 30, 2010, 3:20pm
5
yes it will work but i was looking for more efficient code.
thanks
Perhaps a little handler to do the try/catch for you will make it more to your liking:
to tryRunning scriptName
try
run scriptName
catch
logError "Error running script " & scriptName & ": " & the exception
end try
end tryRunning
Then your main script will look more like this:
tryRunning a.1
tryRunning a.2
tryRunning a.3