nobbe Posted March 5, 2008 Posted March 5, 2008 hi im trying to "remote control" mplayer - i can capture the output from the mplayer (time in seconds etc) but my keyboard commands dont seem to get to mplayer ? expandcollapse popup#include <GUIConstants.au3> ;#include <Constants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 633, 454, 193, 115) $btn_forward = GUICtrlCreateButton(">", 8, 16, 75, 25, 0) $btn_pause = GUICtrlCreateButton("pause", 104, 16, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### START Koda GUI section ### Form= $mplayerpid = Run('mplayer.exe test.mp3', @ScriptDir, @SW_MAXIMIZE, $STDERR_CHILD + $STDOUT_CHILD + $STDIN_CHILD) While 1 $nMsg = GUIGetMsg() Switch $nMsg ;; doesnt work Case $btn_forward ;; MsgBox(0,"test", "forward"); ; Write string to be sorted to child sort.exe's STDIN StdinWrite($mplayerpid, Chr(26)) ; right arrow Case $btn_pause ConsoleWrite("sending pause" & @CRLF); StdinWrite($mplayerpid, 'p') ; If @error = -1 Then ConsoleWrite("error sending pause" & @CRLF); EndIf Case $GUI_EVENT_CLOSE ;ok ProcessClose($mplayerpid) Exit EndSwitch ;; this works - output is now displayed in scite window $c = StdoutRead($mplayerpid) ConsoleWrite($c & @LF); WEnd
vwnerd Posted April 13, 2008 Posted April 13, 2008 Greetings, I'm doing something very similar at the moment, and I had the same problem until I remembered to flush stdin. That should solve your problem. -Max
ProgAndy Posted April 13, 2008 Posted April 13, 2008 (edited) Maybe you need to sen CRLF after the commandNO, just LF:3.2.3 Slave modeThe slave mode allow you to build simple frontend to MPlayer. When enabled (with the -slave option) MPlayer will read commands separated by new line (\n) from stdin. Edited April 13, 2008 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now