2. Möglichkeit:
Achtung nur für Erfahrene Anwender!
Meine Lieblingsskriptsprache ist Autohotkey... In dessen Forum hat einer ein nettes Skript zum abspielen von Videos gemacht (und dazu einen Wrapper geschrieben...).
Dieser könnte man in Autoit auch verwenden:
Kurze Erklärung des Wrappers:
Du öffnest WPFMediaElementByAHK.exe mit folgenden Parametern in der Reihenfolge gegen unten:
1. Pfad zum Film oder Musik oder was auch immer
2. Breite des Frames
3. Höhe des Frames
4. X Position
5. Y Position
Danach nimmst du das Handle des Fensters namens "WPFMediaElementByAhkCodeStartUp#1"
Danach führst du das da aus:
DllCall("user32.dll", "int", "SendMessage", "hWnd", <hier muss das geholte handle rein>, "int", 1280, "int", <hier muss das handle deines guis rein>, "int", 0)
Die weiteren befehlen musst du selber übersetzten...(ist einfach...)
AHK Befehl:
SendMessage,1281,0,0,,ahk_id %handleOfME%
Übersetzter Autoitbefehl:
DllCall("user32.dll", "int", "SendMessage", "hWnd", <hier muss das geholte handle rein>, "int", 1281, "int", 0, "int", 0)
#include-once #include <IE.au3> #Region Header #cs Title: VLC UDF Library for AutoIt3 Filename: VLC.au3 Description: A collection of functions for creating and controlling a VLC control in AutoIT Author: seangriffin Version: V0.3 Last Update: 17/05/10 Requirements: AutoIt3 3.2 or higher, A VLC version greater than 0.8.5 installed Changelog: --------17/05/10----------- v0.3 Added the function _GUICtrlVLC_GetVolume. Added the function _GUICtrlVLC_SetVolume. Added the function _GUICtrlVLC_GetMute. Added the function _GUICtrlVLC_SetMute.
--------15/05/10----------- v0.2 Changed _GUICtrlVLC_GetState to return 0 if no playlist items. Changed _GUICtrlVLC_Pause to return 0 if no playlist items. Changed _GUICtrlVLC_Stop to return 0 if no playlist items. Changed _GUICtrlVLC_SeekRelative to return 0 if no playlist items. Changed _GUICtrlVLC_SeekAbsolute to return 0 if no playlist items. Added error handling to all functions. Added the function _VLCErrorHandlerRegister. Added the function __VLCInternalErrorHandler.
---------08/05/10---------- v0.1 Initial release. Note that a clipping problem currently exists in the VLC control.
#ce #EndRegion Header #Region Global Variables and Constants Global $oVLCErrorHandler, $sVLCUserErrorHandler #EndRegion Global Variables and Constants #Region Core functions ; #FUNCTION# ;=============================================================================== ; ; Name...........: _GUICtrlVLC_Create() ; Description ...: Creates a VLC control. ; Syntax.........: _GUICtrlVLC_Create($left, $top, $width, $height) ; Parameters ....: $left - The left side of the control. ; $top - The top of the control. ; $width - The width of the control ; $height - The height of the control ; Return values .: On Success - Returns the identifier (controlID) of the new control. ; On Failure - Returns False. ; Author ........: seangriffin ; Modified.......: ; Remarks .......: This function must be used before any other function in the UDF is used. ; There is currently a clipping problem with the control, where the video ; is overdrawn by any other window that overlaps it. There is no known ; solution at this time. ; ; Related .......: ; Link ..........: ; Example .......: Yes ; ; ;========================================================================================== Func _GUICtrlVLC_Create($left, $top, $width, $height)
; #FUNCTION# ;=============================================================================== ; ; Name...........: _GUICtrlVLC_Add ; Description ...: Adds a video to the playlist of a VLC control. ; Syntax.........: _GUICtrlVLC_Add($vlc, $path) ; Parameters ....: $vlc - The control identifier (controlID) as returned by _GUICtrlVLC_Create. ; $path - The full path, including filename, of the video to add. ; Return values .: On Success - Returns a number as an item identifier in playlist. ; On Failure - Returns False. ; Author ........: seangriffin ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: Yes ; ; ;========================================================================================== Func _GUICtrlVLC_Add($vlc, $path)
; #FUNCTION# ;=============================================================================== ; ; Name...........: _GUICtrlVLC_Play ; Description ...: Plays a video in the playlist of a VLC control. ; Syntax.........: _GUICtrlVLC_Play($vlc, $item) ; Parameters ....: $vlc - The control identifier (controlID) as returned by _GUICtrlVLC_Create. ; $item - The item in playlist to play, as returned by _GUICtrlVLC_Add. ; Return values .: On Success - Returns True. ; On Failure - Returns False. ; Author ........: seangriffin ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: Yes ; ; ;========================================================================================== Func _GUICtrlVLC_Play($vlc, $item)
if IsObj($vlc) = False Then Return False
$vlc.playlist.playItem($item) Return True EndFunc
; #FUNCTION# ;=============================================================================== ; ; Name...........: _GUICtrlVLC_Pause ; Description ...: Pauses and unpauses the playing video. ; Syntax.........: _GUICtrlVLC_Pause($vlc) ; Parameters ....: $vlc - The control identifier (controlID) as returned by _GUICtrlVLC_Create. ; Return values .: On Success - Returns True. ; On Failure - Returns False. ; Author ........: seangriffin ; Modified.......: ; Remarks .......: Each time this function is called, the paused state of the video is toggled. ; Related .......: ; Link ..........: ; Example .......: Yes ; ; ;========================================================================================== Func _GUICtrlVLC_Pause($vlc)
if IsObj($vlc) = False Then Return False
if $vlc.playlist.items.count = 0 Then
Return 0 Else
$vlc.playlist.togglePause() EndIf EndFunc
; #FUNCTION# ;=============================================================================== ; ; Name...........: _GUICtrlVLC_Stop ; Description ...: Stops the playing video. ; Syntax.........: _GUICtrlVLC_Stop($vlc) ; Parameters ....: $vlc - The control identifier (controlID) as returned by _GUICtrlVLC_Create. ; Return values .: On Success - Returns True. ; On Failure - Returns False. ; Author ........: seangriffin ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: Yes ; ; ;========================================================================================== Func _GUICtrlVLC_Stop($vlc)
if IsObj($vlc) = False Then Return False
if $vlc.playlist.items.count = 0 Then
Return 0 Else
$vlc.playlist.stop() EndIf EndFunc
; #FUNCTION# ;=============================================================================== ; ; Name...........: _GUICtrlVLC_Clear ; Description ...: Clears the playlist of a VLC control (removes all videos). ; Syntax.........: _GUICtrlVLC_Clear($vlc) ; Parameters ....: $vlc - The control identifier (controlID) as returned by _GUICtrlVLC_Create. ; Return values .: On Success - Returns True. ; On Failure - Returns False. ; Author ........: seangriffin ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: Yes ; ; ;========================================================================================== Func _GUICtrlVLC_Clear($vlc)
if IsObj($vlc) = False Then Return False
$vlc.playlist.items.clear()
while $vlc.playlist.items.count > 0 WEnd
Sleep(250) Return True EndFunc
; #FUNCTION# ;=============================================================================== ; ; Name...........: _GUICtrlVLC_SeekRelative ; Description ...: Seek a relative number of milliseconds through the playing video. ; Syntax.........: _GUICtrlVLC_SeekRelative($vlc, $time) ; Parameters ....: $vlc - The control identifier (controlID) as returned by _GUICtrlVLC_Create. ; $time - A number of milliseconds to seek (negative values seek backwards). ; Return values .: On Success - Returns True. ; On Failure - Returns False. ; Author ........: seangriffin ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: Yes ; ; ;========================================================================================== Func _GUICtrlVLC_SeekRelative($vlc, $time)
; #FUNCTION# ;=============================================================================== ; ; Name...........: _GUICtrlVLC_SeekAbsolute ; Description ...: Seek to an absolute location in time in the playing video. ; Syntax.........: _GUICtrlVLC_SeekAbsolute($vlc, $time) ; Parameters ....: $vlc - The control identifier (controlID) as returned by _GUICtrlVLC_Create. ; $time - The number of milliseconds from the start of the video to seek to. ; Return values .: On Success - Returns True. ; On Failure - Returns False. ; Author ........: seangriffin ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: Yes ; ; ;========================================================================================== Func _GUICtrlVLC_SeekAbsolute($vlc, $time)
if IsObj($vlc) = False Then Return False
if $vlc.playlist.items.count = 0 Then
Return 0 Else
$vlc.input.time = $time EndIf EndFunc
; #FUNCTION# ;=============================================================================== ; ; Name...........: _GUICtrlVLC_GetState ; Description ...: Get the current state of the playing video. ; Syntax.........: _GUICtrlVLC_GetState($vlc) ; Parameters ....: $vlc - The control identifier (controlID) as returned by _GUICtrlVLC_Create. ; Return values .: On Success - Returns a number representing the state of the video: ; (IDLE=0, OPENING=1, BUFFERING=2, PLAYING=3, PAUSED=4, STOPPING=5, ENDED=6, ERROR=7) ; On Failure - Returns 0. ; Author ........: seangriffin ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: Yes ; ; ;========================================================================================== Func _GUICtrlVLC_GetState($vlc)
if IsObj($vlc) = False Then Return False
if $vlc.playlist.items.count = 0 Then
Return 0 Else
Return $vlc.input.state EndIf EndFunc
; #FUNCTION# ;=============================================================================== ; ; Name...........: _GUICtrlVLC_GetLength ; Description ...: Get the length of the playing video. ; Syntax.........: _GUICtrlVLC_GetLength($vlc) ; Parameters ....: $vlc - The control identifier (controlID) as returned by _GUICtrlVLC_Create. ; Return values .: On Success - Returns the length of the video in milliseconds. ; On Failure - Returns False. ; Author ........: seangriffin ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: Yes ; ; ;========================================================================================== Func _GUICtrlVLC_GetLength($vlc)
if IsObj($vlc) = False Then Return False
Return $vlc.input.length EndFunc
; #FUNCTION# ;=============================================================================== ; ; Name...........: _GUICtrlVLC_GetMute ; Description ...: Gets the mute setting of the playing video. ; Syntax.........: _GUICtrlVLC_GetMute($vlc) ; Parameters ....: $vlc - The control identifier (controlID) as returned by _GUICtrlVLC_Create. ; Return values .: If muted - Returns True. ; If not muted - Returns False. ; Author ........: seangriffin ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: Yes ; ; ;========================================================================================== Func _GUICtrlVLC_GetMute($vlc)
if IsObj($vlc) = False Then Return False
Return $vlc.audio.mute EndFunc
; #FUNCTION# ;=============================================================================== ; ; Name...........: _GUICtrlVLC_GetTime ; Description ...: Get the absolute position of the playing video. ; Syntax.........: _GUICtrlVLC_GetTime($vlc) ; Parameters ....: $vlc - The control identifier (controlID) as returned by _GUICtrlVLC_Create. ; Return values .: On Success - Returns the position of the playing video in milliseconds. ; On Failure - Returns False. ; Author ........: seangriffin ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: Yes ; ; ;========================================================================================== Func _GUICtrlVLC_GetTime($vlc)
if IsObj($vlc) = False Then Return False
Return $vlc.input.time EndFunc
; #FUNCTION# ;=============================================================================== ; ; Name...........: _GUICtrlVLC_GetVolume ; Description ...: Gets the volume of the playing video. ; Syntax.........: _GUICtrlVLC_GetVolume($vlc) ; Parameters ....: $vlc - The control identifier (controlID) as returned by _GUICtrlVLC_Create. ; Return values .: On Success - Returns the percentage of the volume [0-200]. ; On Failure - Returns False. ; Author ........: seangriffin ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: Yes ; ; ;========================================================================================== Func _GUICtrlVLC_GetVolume($vlc)
if IsObj($vlc) = False Then Return False
Return $vlc.audio.volume EndFunc
; #FUNCTION# ;=============================================================================== ; ; Name...........: _GUICtrlVLC_SetMute ; Description ...: Mutes and unmutes the volume of the playing video. ; Syntax.........: _GUICtrlVLC_SetMute($vlc, $toggle) ; Parameters ....: $vlc - The control identifier (controlID) as returned by _GUICtrlVLC_Create. ; $toggle - boolean value to mute and ummute the audio. ; Return values .: On Success - Returns True. ; On Failure - Returns False. ; Author ........: seangriffin ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: Yes ; ; ;========================================================================================== Func _GUICtrlVLC_SetMute($vlc, $toggle)
if IsObj($vlc) = False Then Return False
$vlc.audio.mute = $toggle
Return True EndFunc
; #FUNCTION# ;=============================================================================== ; ; Name...........: _GUICtrlVLC_SetVolume ; Description ...: Sets the volume of the playing video. ; Syntax.........: _GUICtrlVLC_SetVolume($vlc, $level) ; Parameters ....: $vlc - The control identifier (controlID) as returned by _GUICtrlVLC_Create. ; $level - a value between [0-200] which indicates a percentage of the volume. ; Return values .: On Success - Returns True. ; On Failure - Returns False. ; Author ........: seangriffin ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: Yes ; ; ;========================================================================================== Func _GUICtrlVLC_SetVolume($vlc, $level)
if IsObj($vlc) = False Then Return False
$vlc.audio.volume = $level
Return True EndFunc
; #FUNCTION# ;=============================================================================== ; ; Name...........: _VLCErrorHandlerRegister() ; Description ...: Register and enable a VLC ActiveX error handler. ; Syntax.........: _VLCErrorHandlerRegister($s_functionName = "__VLCInternalErrorHandler") ; Parameters ....: $s_functionName - The name of the AutoIT function to run if an error occurs. ; Return values .: On Success - Returns 1 ; On Failure - Returns 0 ; Author ........: seangriffin ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: Yes ; ; ;========================================================================================== Func _VLCErrorHandlerRegister($s_functionName = "__VLCInternalErrorHandler")
msgbox(0, "VLC UDF Example", "_GUICtrlVLC_Create failed." & @CRLF & _ "The most likely cause is that you don't have VLC installed." & @CRLF & _ "Make sure VLC, and the ActiveX component, is installed.") Exit EndIf
@lolkop
bei mir öffnet er ein großes fenster und in dem ein kleines windows media player aber das Video wird nicht abgespielt .... liegt es vll am format?(ist mp4)
@TrickGamer
Hmm kommt Fehler wegen der #include <VLC.au3>..
€:geht nun hatte ausversehen VCL getippt^^
aber dauert lange biss er startet...
€2:kannst du mir das vll bissel umbauenß´?
Film ;) 10/26/2010 - Main - 2 Replies Hey,
Sagt mir mal bitte einen guten Film in der Kategorie: Action/SciFI/Horror/thriller.
Wäre nett wenn ihr mir n paar gute Filme nennen könntet ;)
.RiDA
My fav film 03/19/2010 - Movies & Series - 2 Replies Is star wars nuff said hehehe