I've been wanting to automate this for a while, because it takes all of a minute to set up my screens the way I like when I come to my computer. Heh.
The task is to load three images, each on a different screen, and set them to fullscreen mode. Along the way I found some solutions that suggested using the pixel dimensions of the monitors to align the images, but I found that unnecessarily complicated and I couldn't make it work when the screens are not horizontally aligned.
A comment on one post suggested using the free tool Amethyst, which is a tiling window manager. Amethyst understands the monitor layout, and can move windows between screens with a keystroke. To send a keystroke you can use a key code in AppleScript.
There is a wonderful key code reference that helped figuring out some of the codes I needed.
I found that while I can modify the key code using the shift, option or command keys, I could not modify it using the function key. Fortunately, I was able to use the free key codes utility by Many Tricks to determine that Preview will accept Control-Command-F as well as Fn-F to go fullscreen.
Also note this requires changes to the accessibility control panel to allow keystrokes to be sent from the script. I have not been able to use the script saved as an app due to security limitations. That would be nice because I could tell Siri to launch the script.
So here is my script for posterity.
-- Change these paths to your actual images
set image1 to POSIX file "/Users/me/Pictures/pic1.webp"
set image2 to POSIX file "/Users/me/Pictures/pic2.jpeg"
set image3 to POSIX file "/Users/me/Pictures/pic3.png"
-- Arrange windows on different displays
-- key code 13 / w / screen 1
-- key code 14 / e / screen 2
-- key code 15 / r / screen 3
-- key code 3 / f / fullscreen
-- Open Amethyst
tell application "Amethyst"
activate
end tell
-- Open images in Preview
tell application "Preview"
activate
open {image1}
end tell
delay 1 -- wait for Preview to open
tell application "System Events" to key code 13 using {control down, option down, shift down}
delay 1
-- send a key code to Preview
tell application "System Events" to key code 3 using {control down, command down}
delay 1 -- wait before opening next image
tell application "Preview"
activate
open {image2}
delay 1 -- wait for Preview to open
tell application "System Events" to key code 15 using {control down, option down, shift down}
delay 1
tell application "System Events" to key code 3 using {control down, command down}
end tell
delay 1 -- wait before opening next image
tell application "Preview"
activate
open {image3}
delay 1 -- wait for Preview to open
tell application "System Events" to key code 14 using {control down, option down, shift down}
delay 1
tell application "System Events" to key code 3 using {control down, command down}
end tell
quit