Universal Control bug with Applescript keystroke

Hello I am using 2 mac pros with both Monterrey 12.4. and using magic mouse and magic keyboard.

Lets name Macpro A and Macpro B, Macpro A has bluetooth connection to magic mouse and keyboard and I am able to use Universal Control seamlessly across both devices from my bt keyboard/mouse.

On macpro B, I have an applescript that opens an application and input 2 strings, each string in a text field using keystroke. The string with special characters gets truncated when applesript tries to write the stirng to the text field. For example, the string "YrR#truT0fmuD$123'45" will get truncated to "YrR#t"

The truncation is very inconsistent but I discovered that if I run the same script on macpro A, it works fine and when Universal control is off then it also works fine.

My example script is below, i've removed the application name

on run argv
	-- Launch myapplication.app
	activate application "myapplication"
	tell application "System Events"
		-- Wait until it launches
		repeat until (exists window "My Application" of application process "JavaApplicationStub")
			delay 1
		end repeat
		delay 1
		
		-- proccess
		tell application process "JavaApplicationStub"
			
			-- window of the process
			tell window "My Application"
				-- enter name
				set focused of text field 1 to true
				keystroke "a" using command down
				keystroke (item 1 of argv)
				
				-- enter lastname
				set focused of text field 2 to true
				keystroke "a" using command down
				keystroke (item 2 of argv)
				
				-- click Login
				# click button 5
			end tell
		end tell
	end tell
end run
Universal Control bug with Applescript keystroke
 
 
Q