Skip to content

Instantly share code, notes, and snippets.

@tmplinshi
Created October 30, 2018 08:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmplinshi/05c1c395b86916f79b01d66400e6180f to your computer and use it in GitHub Desktop.
Save tmplinshi/05c1c395b86916f79b01d66400e6180f to your computer and use it in GitHub Desktop.
Gui, +HWNDhGUI
Gui, Add, Text, x50 y50 w700 h500 HWNDhText,
Gui, Show, w800 h620
mpv := "D:\Program Files\mpv\mpv.exe"
Run, %mpv% --idle --input-ipc-server=\\.\pipe\mpvsocket --wid=%hText% ; Or --wid=%hGUI%
return
GuiDropFiles:
mpv_loadfile(A_GuiEvent)
return
mpv_loadfile(ByRef filename) {
mpv_command("loadfile """ StrReplace(filename, "\", "\\") """")
}
mpv_command(ByRef sCommand) {
Run, %ComSpec% /c echo %sCommand% > \\.\pipe\mpvsocket,, Hide
}
GuiClose:
ExitApp
WM_KeyDown(wParam, lParam, nMsg, hWnd) {
static _ := OnMessage(0x100, "WM_KeyDown")
key := GetKeyName( Chr(wParam) )
ControlSend, mpv1, % "{" key "}", A
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment