Jump to content
Sign in to follow this  
SpRaY

WMP

Recommended Posts

Dunno...

but this works great!!

; Script Start - Add your code below here

#include <GuiConstants.au3>
Opt("WinTitleMatchMode",2)
Opt("OnExitFunc","_exit")
Opt("GuiOnEventMode",1)
Global $mystatus = "Paused"
Global $pause = 0
Global $wintitle = "none"
$GUI = GuiCreate("VideoPlayer",400,35,350,300,-1)
$PLAY = GUICtrlCreateButton("Play",41,2,40,30)
$PAUSEBUT = GUICtrlCreateButton("Pause",82,2,40,30)
$STOP = GUICtrlCreateButton("Stop",123,2,40,30)
$LOAD = GUICtrlCreateButton("Load",164,2,40,30)
$STATUS = GUICtrlCreateLabel("Status: "&$mystatus&@CRLF,206,0,-1,30)
GuiSetState()
GUISetOnEvent($GUI_EVENT_CLOSE,"_Exit")
GUISetOnEvent($GUI_EVENT_MINIMIZE,"_Minimize")
GUISetOnEvent($GUI_EVENT_RESTORE,"_Restore")
GuiCtrlSetOnEvent($PLAY,"_Play")
GuiCtrlSetOnEvent($STOP,"_Stop")
GuiCtrlSetOnEvent($LOAD,"_Load")
GuiCtrlSetOnEvent($PAUSEBUT,"_Pause")

HotKeySet("^{DEL}","_Exit")
While 1
    $stateplayer = WinGetState("VideoPlayer", "")
    if BitAnd($stateplayer ,8) Then
        $statemovie = WinGetState("VideoMovie", "")
        If BitAnd($statemovie, 16) Then
        WinSetState("VideoMovie","",@SW_RESTORE)
        EndIf
    EndIf
    sleep(50)
Wend

Func mciSendString($string)
   Local $ret
   $ret = DllCall("winmm.dll","int","mciSendString","str",$string,"str","","int",65534,"hwnd",0)
   If Not @error Then Return $ret[2]
EndFunc
Func _Exit()
    mciSendString("Close myvideo")
    Exit
EndFunc

Func _Play()
    $pause = 0
    mciSendString("play myvideo repeat")
    $mystatus = "PLAYING"
    Guictrlsetdata($STATUS,"Status: "&$mystatus&@CRLF)
    WinSetTitle($wintitle,"","VideoMovie")
EndFunc
Func _Stop()
    mciSendString("Stop myvideo")
    mciSendString("seek myvideo to start")
    $mystatus = "STOPPED"
    Guictrlsetdata($STATUS,"Status: "&$mystatus&@CRLF)
EndFunc
Func _Load()
    mciSendString("Close myvideo")
    $file = FileOpenDialog("OPEN","","Video (*.mp3;*.avi;*.mpg)")
    $wintitle = stringsplit($file,"\")
    $wintitle = $wintitle[$wintitle[0]]
    $file = '"'&$file&'"'
    mciSendString("open "&$file&" alias myvideo")
    _Play()
EndFunc
Func _Pause()
    If $pause = 0 Then
        mciSendString("stop myvideo")
        $mystatus = "PAUSED"
        Guictrlsetdata($STATUS,"Status: "&$mystatus&@CRLF)
        $pause = 1
    Else
        _Play()
    EndIf
EndFunc

Func _Minimize()
    WinSetState("VideoMovie","",@SW_MINIMIZE)
EndFunc
Func _Restore()
    WinSetState("VideoMovie","",@SW_RESTORE)
EndFunc

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...