maybe you could use a tool to capture the code in a different language and then translate it into applescript yourself
doesn't even need to be applescript. can be also jxa, shell, or swift. if i had ANY capture tools for ANY (as well as a more reliable capture tool for applescript) that would be a huge breakthrough. i already have the 'accessibility inspector' in xcode, but that doesn't quite often tell me the right answers