音频动画UDF



;----------------------------------
;-------QuickTime Functions--------
;----------------------------------

#cs
_qtcreate($show, $left, $top, $width = 100, $height = 100)
$show:     1 = creates the control
           2 = doesn't create the control

Return: The object for the control
#ce
Func _qtcreate($show, $left, $top, $width = 100, $height = 100)
    $oQT = ObjCreate("QTOControl.QTControl")
    If $oQT = 0 Then Return 0
    If $show = 1 Then
        GUICtrlCreateObj($oQT, $left, $top, $width, $height)
    EndIf
    Return $oQT
EndFunc
#cs
_qtloadmedia( $object, $URL, $autostart = 1 )
$object:       Object returned from the _qtcreate()
$URL:          Path or URL of the media
$autostart:    1 = yes
               0 = no

Return: None
#ce
Func _qtloadmedia( $object, $URL, $autostart = 1 )
    $object.URL = $URL
    _qtautostart($object, $autostart)
EndFunc
#cs
_qtautostart($object, $autostart)
$object:    Object returned from the _qtcreate()
$param:     0 = disable autoplay
            1 = enable autoplay

Return: The object for the control
#ce
Func _qtautostart($object, $autostart)
    If $autostart = 0 Then
        $object.Autoplay = False
    ElseIf $autostart = 1 Then
        $object.Autoplay = True
    EndIf
EndFunc
#cs
_qtgetv($object)
$object:    Object returned from the _qtcreate()

Return: version of quicktime
#ce
Func _qtgetv($object)
        $Version = $object.QuickTimeVersion()
    Return $Version
EndFunc



;----------------------------------
;------Adobe Flash Functions-------
;----------------------------------

#cs
_flashcreate($show, $left, $top, $width = 100, $height = 100)
$show:      1 = creates the control
            2 = doesn't create the control

Return: The object for the control
#ce
Func _flashcreate($show, $left, $top, $width = 100, $height = 100)
    If FileFindFirstFile(@SystemDir & "\Macromed\Flash\flash*.ocx") = -1 Then
        $Value = MsgBox(20, "Error", "It seems that you don't have Flash Player installed. Please download" & @CRLF & "it from www.adobe.com. Do you want to go there now?")
        If $Value = 6 Then
            ShellExecute("www.adobe.com")
        EndIf
        Exit
    EndIf        
    $oFlash = ObjCreate("ShockwaveFlash.ShockwaveFlash")
    If $oFlash = 0 Then Return 0
    If $show = 1 Then
        GUICtrlCreateObj($oFlash, $left, $top, $width, $height)
    EndIf
    Return $oFlash
EndFunc
#cs
_flashloadmedia($object, $URL)
$object:       Object returned from the _flashcreate()
$URL:          Path or URL of the media
Return: None
#ce
Func _flashloadmedia($object, $URL)
    $object.LoadMovie(0, $URL)
EndFunc
#cs
_flashsetvalue($object, $setting)
$object:    Object returned from the _flashcreate()
$setting:   "play"
            "stop"

Return: None
#ce
Func _flashvalue($object, $setting)
        Select
    Case $setting = "play"
            $object.play()
        Case $setting = "stop"
            $object.stop()
    EndSelect
EndFunc


;----------------------------------
;--Windows Media Player Functions--
;----------------------------------

#cs
_wmpcreate($show, $left, $top, $width = 100, $height = 100)
$show:     1 = shows controls
           2 = hides controls

Return: The object for the control
#ce
Func _wmpcreate($show, $left, $top, $width = 100, $height = 100)
$oWMP = ObjCreate("WMPlayer.OCX")
If $oWMP = 0 Then Return 0
$oWMP.settings.autoStart = "False"
If $show = 1 Then
    GUICtrlCreateObj($oWMP, $left, $top, $width, $height)
EndIf
Return $oWMP
EndFunc
#cs
_wmploadmedia( $object, $URL, $autostart = 1 )
$object:    Object returned from the _wmpcreate()
$URL:        Path or URL of the media
$autostart:    1 = yes
               0 = no

Return: None
#ce
Func _wmploadmedia( $object, $URL, $autostart = 1 )
    $object.URL = $URL
    While Not $object.controls.isAvailable("play")
        Sleep(1)
    WEnd
    If $autostart = 1 Then $object.controls.play()
EndFunc
#cs
_wmpsetvalue( $object, $setting, $para=1 )
$object:    Object returned from the _wmpcreate()
$setting:   "play"
            "stop"
            "pause"
            "invisible" (Hides all)
            "control"    (Shows controls)
            "nocontrol"    (Hides controls)
            "fullscreen"
            "step"        (frames to step before freezing)
            "fastforward"
            "fastreverse"
            "volume"    (0 To 100)
            "rate"        (-10 To 10)
            "playcount"

Return: None
#ce
Func _wmpvalue( $object, $setting, $para=1 )
        Select
            Case $setting = "play"
            If $object.controls.isAvailable("play") Then $object.controls.play()
        Case $setting = "stop"
            If $object.controls.isAvailable("stop") Then $object.controls.stop()
        Case $setting = "pause"
            If $object.controls.isAvailable("pause") Then $object.controls.pause()
        Case $setting = "invisible"
            $object.uiMode = "invisible"
        Case $setting = "controls"
            $object.uiMode = "mini"
        Case $setting = "nocontrols"
            $object.uiMode = "none"
        Case $setting = "fullscreen"
            $object.fullscreen = "true"
        Case $setting = "step"
            If $object.controls.isAvailable("step") Then $object.controls.step($para)
        Case $setting = "fastForward"
            If $object.controls.isAvailable("fastForward") Then $object.controls.fastForward()
        Case $setting = "fastReverse"
            If $object.controls.isAvailable("fastReverse") Then $object.controls.fastReverse()
        Case $setting = "volume"
            $object.settings.volume = $para
        Case $setting = "rate"
            $object.settings.rate = $para
        Case $setting = "playcount"
            $object.settings.playCount = $para
        Case $setting = "setposition"
            $object.controls.currentPosition = $para
        Case $setting = "getposition"
            Return $object.controls.currentPosition
        Case $setting = "getpositionstring";Returns HH:MM:SS
            Return $object.controls.currentPositionString
        Case $setting = "getduration"
            Return $object.currentMedia.duration
    EndSelect
EndFunc

完整音频UDF下载:




文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags: QuickTime Flash Windows Media Player
相关日志:
评论: 1 | 引用: 0 | 查看次数: 713
回复回复brianprc[2010-06-21 02:49 PM | del]
Good Script for Media & Flash Player in AU3
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 1000 字 | UBB代码 开启 | [img]标签 开启