Here's an excellent explanation of how to get variables from Automator actions into your AppleScript within Automator.
I actually had this open on my iPad, but apparently it hadn't registered in my brain. But, it will now! 💡
Originally posted at Nice Marmot 16:14 Wednesday, 13 March 2024