Resolve from email when ticket is stalled

I have put together a scrip that resolves ticket when body contains the
"key words" thanks to prior help from the list

I have found a problem that I did not anticipate, and can not figure
out how to solve.

The scrip works as expected, as long as the ticket is open or new. If
the ticket is stalled (or pending, we use both) then it appears as
though the Global “On Correspond Open Tickets” is firing off AFTER my
"Resolve by Email" noted in the earlier thread. So the end result is
the ticket is Resolved, and then Opened all with the same

I can not figure out how to overcome this problem. Hoping someone on
the list has some ideas for me.

Associate yourself with men of good quality if you esteem
your own reputation; for 'tis better to be alone then in bad
company. - George Washington, Rules of Civility

My guess would be that you need to look at TransactionBatch

Cambridge Energy Alliance: Save money. Save the planet.