An Issue while Using with Transaction()
I am currently experiencing an issue with my script, which is divided into three main parts. The first part uses Auto_Detection to create the initial Connection Group and performs specific operations based on keywords. The second part sorts and classifies the created Contact Regions. The third part performs a new Auto_Detection based on the classified data to generate different Connection Groups.
The problem occurs when I wrap all parts of the script within with Transaction(suspendClicks=True).
Some operations fail, such as the following code in the first part:
if any(key in contact_bodies_2 and key in target_bodies_2 for key in keywords):
cont_region_2.Delete()
This line works properly when I don't use with Transaction, but the execution speed becomes significantly slower. Could you please provide assistance with this issue?
My scripts are shown below,
Part1:
Part2:
Part3:
Answers
-
It maybe that the state of the connection(s) is not being updated before it is acted upon for a second time. I would try using 2 or 3 seperate 'with Transaction' blocks
0 -
I followed the suggestion and separated the script into multiple with Transaction blocks as below, but it still didn’t solve the problem. The content that needs to be deleted in the original connection group is still not being removed. Could you please provide further assistance?
Part1:
Part2:
Part3:
Result:
0