Created
March 30, 2019 17:26
-
-
Save mrworf/8057f40215cc10e748124084e3e5987a to your computer and use it in GitHub Desktop.
Allows making/receiving calls on a computer used for Plex Media Player
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <MsgBoxConstants.au3> | |
#include <AutoItConstants.au3> | |
Opt("SendKeyDelay", 50) | |
Opt("SendAttachMode", 1) | |
Opt("SendKeyDownDelay", 50) | |
Global $g_bInACall = False | |
HotKeySet ( "+!^c" , "Call" ) | |
HotKeySet ( "+!^e" , "EndCall" ) | |
HotKeySet ( "+!^a" , "AnswerCall" ) | |
While (1) | |
Sleep(100) | |
WEnd | |
Func PlexClose() | |
Local $hWnd = WinGetHandle("[CLASS:Qt5QWindowOwnDCIcon; TITLE:Plex Media Player]") | |
if @error Then | |
Return | |
EndIf | |
;WinClose($hWnd) | |
WinActivate($hWnd) | |
Sleep(100) | |
WinClose($hWnd) | |
EndFunc | |
Func PlexStart() | |
Local $hWnd = WinGetHandle("[CLASS:Qt5QWindowOwnDCIcon; TITLE:Plex Media Player]") | |
if @error Then | |
Run("C:\Program Files\Plex\Plex Media Player\PlexMediaPlayer.exe") | |
Return | |
EndIf | |
WinActivate($hWnd) | |
WinSetState($hWnd, "", @SW_MAXIMIZE) | |
EndFunc | |
Func Call() | |
LaunchCall("Echo") | |
EndFunc | |
Func GetSkypeWnd() | |
Local $hWnd = WinGetHandle("[CLASS:ApplicationFrameWindow; TITLE:Skype]") | |
If @error Then | |
ShellExecute("skype://") | |
Local $tests = 0 | |
Do | |
Sleep(100) | |
$tests = $tests + 1 | |
$hWnd = WinGetHandle("[CLASS:ApplicationFrameWindow; TITLE:Skype]") | |
Until not @error or $tests == 100 | |
if $tests == 100 Then | |
return 0 | |
EndIf | |
EndIf | |
WinActivate($hWnd) | |
WinSetState($hWnd, "", @SW_MAXIMIZE) | |
Return $hWnd | |
EndFunc | |
Func LaunchCall($sContact) | |
if $g_bInACall Then | |
Return | |
EndIf | |
PlexClose() | |
Local $hWnd = GetSkypeWnd() | |
if $hWnd == 0 Then | |
exit 1 | |
EndIf | |
; Wait for skype to be ready! | |
Sleep(2000) | |
Send("^+S") | |
Sleep(1000) | |
Send("^a") | |
Sleep(100) | |
Send("{DELETE}") | |
Sleep(100) | |
Send($sContact) | |
Sleep(2000) | |
Send("{TAB}{TAB}{TAB}") | |
Sleep(100) | |
Send("{ENTER}") | |
Sleep(100) | |
Send("^+K") | |
$g_bInACall = True | |
EndFunc | |
Func EndCall() | |
if not $g_bInACall Then | |
Return | |
EndIf | |
Local $hWnd = WinGetHandle("[CLASS:ApplicationFrameWindow; TITLE:Skype]") | |
if not @error then | |
WinActivate($hWnd) | |
Send("^e") | |
Sleep(100) | |
WinClose($hWnd) | |
EndIf | |
$g_bInACall = False | |
PlexStart() | |
EndFunc | |
Func AnswerCall() | |
if $g_bInACall Then | |
Return | |
EndIf | |
PlexClose() | |
Local $hWnd = GetSkypeWnd() | |
if $hWnd == 0 Then | |
exit 1 | |
EndIf | |
Sleep(2000) | |
Send("^+p") | |
$g_bInACall = True | |
EndFunc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If it's unable to make the call the first time, just click on the person that it searched for (Default is
echo
) and make a video call. After that, it should always work. This seems to be some issue with UWP and how they deal with tab for cycling between controls in a window.