I'm working on an Applescript to manage a Mac Mini attached to two (soon to be three via a USB video adaptor) TV screens that display various web based stats views.
Chrome was picked for this due to it's full screen mode that removes all the browser UI, along with the Applescript support that was added in a few versions back.
The specific problem I'm having is getting both Chrome windows to go full screen. I can get one to work, but any attempts to bring the second window forward and make it full screen fail. Usually the first window just exits full screen.
Here is one of my iterations at attempting this, if anyone has any ideas, this would be appreciated. This may be hard to test if you don't have two monitors.
(I'm including a slightly cut down version, but including some useful code here if someone else is attempting similar. The code below will open Chrome, loading two tabs in the first window, and one tab in the second. It also attempts to reposition the browsers so one is on the left TV {0,0,1920,1080} and the second is on the right TV {2560, 0, 5120, 1080}. I chose not to auto detect both monitors and position accordingly, as resolution and arrangement won't be changing once this is all set up. The script does assume the monitor on the left has the Mac menu bar to flag it as the primary screen)
Chrome was picked for this due to it's full screen mode that removes all the browser UI, along with the Applescript support that was added in a few versions back.
The specific problem I'm having is getting both Chrome windows to go full screen. I can get one to work, but any attempts to bring the second window forward and make it full screen fail. Usually the first window just exits full screen.
Here is one of my iterations at attempting this, if anyone has any ideas, this would be appreciated. This may be hard to test if you don't have two monitors.
(I'm including a slightly cut down version, but including some useful code here if someone else is attempting similar. The code below will open Chrome, loading two tabs in the first window, and one tab in the second. It also attempts to reposition the browsers so one is on the left TV {0,0,1920,1080} and the second is on the right TV {2560, 0, 5120, 1080}. I chose not to auto detect both monitors and position accordingly, as resolution and arrangement won't be changing once this is all set up. The script does assume the monitor on the left has the Mac menu bar to flag it as the primary screen)
Code:
tell application "Google Chrome"
tell window 1
set URL of active tab to "http://apple.com"
repeat while loading of active tab
delay 0.1
end repeat
set myTab to make new tab at end of tabs with properties {URL:"http://trailers.apple.com"}
repeat while loading of active tab
delay 0.1
end repeat
end tell
end tell
tell first window of application "Google Chrome" to set bounds to {0, 0, 1920, 1080}
tell application "Google Chrome"
set aWin2 to make new window with properties {mode:"normal"}
tell window 1
set URL of active tab to "http://me.com"
repeat while loading of active tab
delay 0.1
end repeat
end tell
end tell
tell first window of application "Google Chrome" to set bounds to {2560, 0, 5120, 1080}
-- Bring Chrome to the front and full screen both windows
tell application "Google Chrome"
activate
end tell
tell application "System Events" to keystroke "f" using {command down, shift down}
delay 3
tell application "Google Chrome"
set index of window 2 to 1
end tell
tell application "System Events" to keystroke "f" using {command down, shift down}