Chrillek, thank you for your time. I see that greediness issue. It’s not my script, so I’m a newcomer to it.
One thing I also see is that I need to rediscover sed. I use regular expressions constantly, often daily, in Python.
Speaking of which, I changed the “do shell script system_profiler…” to:
set displayRes to (do shell script "~/Documents/bin/dtpdisplay.py")
Dtpdisplay.py contains:
#!/usr/bin/python3
import os, re
resRe = re.compile(r'Resolution:\s+(Retina)?.*?([0-9]*)\s+x\s+([0-9]*)')
resReturn = None
resReturn = None
for mtch in resRe.findall(os.popen('system_profiler SPDisplaysDataType').read())
resReturn = f'{mtch[1]} {mtch[2]} {mtch[0]}' if not resReturn or mtch[0] else resReturn
print(resReturn or '640 480')
That gets you the “Retina” line if there is more than one “Resolution” line. If it doesn’t find any “Resolution” lines, it punishes you by assuming a 640x480 display.
Instead of side by side windows, I got overlapping windows, each about 2/3 the width of the display, which is what I got with using the resolution from SPDisplaysDataType.
So, I reverted back to the commented out suggestion, since I don’t use Pathfinder:
tell application "Finder" to set {w, h} to {item 3, item 4} of (bounds of window of desktop as list)
set divisor to 4
Now I get two side by side windows. In total, they span most of the width of the display.
System_profiler returns width and height of 5120 and 2880. The bounds of window method returns width 3968 and height 1318.
It can be vexxing to try to accommodate different systems with a universal script, even one as short as this one.
I’m good with it. I may take out the adaptive lines and just hardcode w and h, since I would prefer narrower windows, anyway.
Thanks again, all.