Ok.. so i figured out that the interface selection is dependent upon how many chromecast devices you have. SO i put together a AutoHotkey variation of Marcel Pennock's code...
This allows you to define how many times the script needs to hit the TAB button... to select the proper casting device from the populated list crhome gives you of detected devices.
So.. if you want to cast to device 2 on your list.. you set the deviceNumber parameter to be the number of the device in the list ( 1 = first device listed.. 2 = second.. etc ).
Also.. I made it so you can select what casting mode you want... be default I set it to DESKTOP ( option 2 ).
Again.. its all about how many times you need to hit TAB to select what you want...
CastOn-1.ahk:
;------------------------------------------------------------
; AutoHotKey Script to START ChromeCast in Desktop Mode
;
; Declare variables
;
; -- Set CastMode (1=TAB 2=DESKTOP 3=FILE)
castMode := 2
deviceNumber := 1
;
delay := 1000
;------------------------------------------------------------
;------------------------------------------------------------
; Run Chrome
Run, C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --fullscreen --start-maximized
;Sleep, delay
Sleep, 5000
#IfWinActive, ahk_class Chrome_WidgetWin_1
; -- SEND the ALT+F key combo to open settings
SendInput !f
Sleep, delay
; -- SEND the C key combo to select CAST
SendInput c
Sleep, delay
;------------------------------------------------------------
;------------------------------------------------------------
; -- Tab to the SOURCES drop down box and select it.
SendInput {TAB 3}
Sleep, delay
SendInput {Enter}
Sleep, delay
;------------------------------------------------------------
;------------------------------------------------------------
; -- Make your Selection ( One DOWN for TAB, Two DOWN for DESKTOP, THREE down for FILE.)
; Select DESKTOP -- TWO DOWN COMMANDS PASSED
SendInput {Down %castMode%}
Sleep, delay
SendInput {Enter}
Sleep, delay
;------------------------------------------------------------
;------------------------------------------------------------
; -- Tab OUT of the Source Selection area .. to be able to select correct device.
SendInput {TAB}
Sleep, delay
; -- Tab to the DEVICE we selected and
SendInput {TAB %deviceNumber%}
Sleep, delay
; -- START CAST.
SendInput {Enter}
Sleep, delay
;------------------------------------------------------------
;------------------------------------------------------------
; -- Minimize window, casting starts
Send {ESC}
Sleep, delay
Send #{d} ; minimize window, casting starts
;------------------------------------------------------------
CastOff-1.ahk:
;------------------------------------------------------------
; AutoHotKey Script to STOP ChromeCast in Desktop Mode
;
; Declare variables
delay := 1000
;------------------------------------------------------------
;------------------------------------------------------------
; Run Chrome
Run, C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --fullscreen --start-maximized
;Sleep, delay
Sleep, 5000
#IfWinActive, ahk_class Chrome_WidgetWin_1
; -- SEND the ALT+F key combo to open settings
SendInput !f
Sleep, delay
; -- SEND the C key combo to select CAST
SendInput c
Sleep, delay
;------------------------------------------------------------
;------------------------------------------------------------
; -- Tab OUT of the Source Selection area .. to be able to select correct device.
SendInput {TAB}
Sleep, delay
; -- Tab to the DEVICE we selected and
SendInput {TAB %deviceNumber%}
Sleep, delay
; -- STOP CAST.
SendInput {Enter}
Sleep, delay
;------------------------------------------------------------
;------------------------------------------------------------
; -- CLOSE window
Send {ESC}
Sleep, delay
Send !{f4} ; close window
;------------------------------------------------------------
I also launch this directly from within a batch file... so i can call the batch file from ANY program.. it comes in handy for applications that allow you to map key or an event into a function or activity.
Example: I have StreamDeck device i use when streaming video.. i can simply map one of the streamdeck buttons.. to launch this batch file.. and bam.. one button press on the device.. and i'm autocasting to my chromecast device as well.
[SCRIPT LOCATION] refers to your local script path obviously replace this.
START_AUTOHOTKEYCHROMECAST.bat
@echo off
cd "C:\Program Files\AutoHotkey" && start "CHROMECAST START" "C:\Program Files\AutoHotkey\AutoHotkey.exe" "[SCRIPT LOCATION]\CastON.ahk"
exit