Script for duplicating mark on duplicate family

Hi All,

I’m trying to create a script that adds mark automatically to appliances. AP-1 for example.
Sometimes I have duplicate appliances and I’d like for both of those to have the AP-1 mark, so a duplicate mark.

My script first tries to filter based on the ‘Type Mark’ parameter
If this type mark is ‘‘AP’’ it should receive the prefix ‘‘AP-’’
Finally I’d like to just mark the families automatically. Like AP-1, AP-2 etc.

I’m running into issues while trying to duplicate a mark on the same family in my script. What might I be doing wrong?

I greatly appreciate any help!

@Yannick spare me a microscope?

Just kidding, your image is not clear enough.

@jshial Whoops! I’ve changed the post so the microscope, won’t be necessary haha