Alt Click AppleScript

I’m trying to help a friend who is looking for an application to manage their DSLR photo library. I have suggested to them that they could use a separate photos library for this purpose. I am trying to help them in making switching between the two photos libraries easier by using an AppleScript in the dock which simulates the alt key being held down when it is clicked.

So you are looking to switch windows by ⌥-clicking the dock icon?

Why not just ⌥-click the icon as designed in macOS?

Or use a BetterTouchTool keyboard macro or gesture.

Or drag each library to the Dock.

I’ve always found that scripts controlling the computer with System Events / GUI scripting often fail more often than they succeed.