Coding a command to make event

Okay so I have been playing with the ar4 software from annin robotics as I have an ar4 robotic arm and the python program talks to a teensy 4.1 and im wanting to add some code so when I switch is pressed it saves my robots position currently this is handled by an event when a mouse button is pressed On a button I have add a link to the code as it won’t let me paste the whole code in

What have you tried? What specific problem are you facing?

You’re not likely to find someone who’s going to read through a 7500+ line script and just hand you the code you need.

I’d just like some pointers of how I can achieve what I have described as I only know the basics I’m not no expert

I’d like to take the input (switch) and once pressed I want it to save the robots position to a position register that’s in the program currently you have to click a button with the mouse in the program

Well, if I were to try to solve a problem like this, I would approach it like this:

  1. Figure out what tool was used to generate the script. While it could theoretically have been written by a person, it looks autogenerated. If you need to edit it, it’s probably easier to do so using the same tool it was made with.
  2. If I can’t figure out what tool was used to make the script, or it turns out someone actually did write the whole thing themselves, I’d throw the whole thing out and start from scratch, using whatever documentation is available. Reading other peoples’ code can be a challenge even if it is meticulously commented and follows best practice coding standards. Reading a 7500+ lines long script someone else wrote simply isn’t viable.
  3. If there is no documentation available, I would give up and do something else.