Automate Microsoft SMS password pasting

Can someone help me automating the horrible cutting and pasting of Microsoft SMS passwords from iMessage to Safari. I tried doing this with KB and picture recognition but It’s to unreliable, someone that knows a fair share of Applescript might have a better solution?