Mark -- I get an error in Automator when I try to use your simplified script. "0:1: syntax error: A unknown token can’t go here. (-2740)"

I'm wondering if something has been screwed up in the copying and pasting into your post? Or from your post to my Automator?

I'm running on MacOS 10.12 Sierra.