Select Monitor & Open Specified Version of Excl

I have a short routine that positions Safari and Excel side by side.My set up is a MacBook with two external monitors and I would like to specify which monitor the applications are positioned on but I not been able to figure it out

Also I have both Excel 2011 and 2016, for a number of reasons I need to use Excel 2011, it is already set as the default application to open Excel files. The routine below works fine if Safari and Excel are open but if they are not and I add a command to open Excel it defaults to the 2016 version.

--Application Position is Left, Top,Width,Height
tell application "Finder"
	set BoundsAll to bounds of window of desktop
	set WinW to item 3 of BoundsAll
	set WinH to item 4 of BoundsAll
end tell
--display dialog WinW as string
tell application "Safari"
end tell
tell application "Safari" to set the bounds of the front window to {0, 22, WinW / 2, WinH - 50}

tell application "Microsoft Excel"
end tell

tell application "Microsoft Excel" to set the bounds of the front window to {WinW / 2, 22, WinW, WinH - 50}

Any ideas very much appreciated

“tell application” doesn’t have to reference the application by name, it can also accept the path as the reference. So when you’ve got multiple programs with the same name, you can target the one you want by path. For example, I use:

tell application "/Applications/Adobe Photoshop CS6/Adobe Photoshop"
end tell

To get CS6 when a CC version is also installed.

Not sure about the monitor thing, may mess with it later if I have time.

Thanks that makes sense will try that

And that works? Last I looked, it required an HFS path, not POSIX.

Hello Shane.
I tested under 10.13.6 and the POSIX path was correctly used.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) vendredi 10 mai 2019 12:08:33

Interesting – thanks, Yvan.

Yeah, we’ve been using it that way to distinguish versions of Adobe apps in dozens of scripts on dozens of computers used dozens of times a day for several years across several OS versions, so it certainly works reliably. If it’s not the documented way, maybe it’ll quit some day and we’ll have to change it.