Change Stream Deck Profile From Macro

With this apple script I load the profile with name "Media" from Stream Deck instance name "XL", very fast.

set deviceName to "XL"
set profileName to "Media"

launch application "System Events"
delay 0.1
ignoring application responses
	tell application "System Events" to tell process "Stream Deck"
		click menu bar item 1 of menu bar 2
	end tell
end ignoring
do shell script "killall System\\ Events"
delay 0.1
tell application "System Events" to tell process "Stream Deck"
	tell menu bar item 1 of menu bar 2
		tell menu item deviceName of menu 1
			click
			click menu item profileName of menu 1
		end tell
	end tell
end tell