1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. eukalyptus

Beiträge von eukalyptus

  • Autostartproblem

    • eukalyptus
    • 15. September 2008 um 20:54

    Eigentlich verhält sich das Script gleich, jedoch ist das Arbeitsverzeichnis ein anderes.

    Wenn man das Script direkt startet, dann reicht IniRead("Inidatei.ini"... weil das Arbeitsverzeichnis gleich dem Scriptverzeichnis ist.
    Beim Start via Registry ist das Arbeitsverzeichnis ein anderes, darum: IniRead(@ScriptDir & "\IniDatei.ini"... sonst sucht er in C:\ oder EigeneDateien nach der Ini-Datei...

    *Ich hab das nicht ausprobiert, aber ich vermute mal, daß es so ist ;)

  • Autostartproblem

    • eukalyptus
    • 12. September 2008 um 19:30

    Ich nehme mal an du meinst folgendes:

    Du hast ein Script, welches einwandfrei läuft, wenn du es "normal" startest.
    Aber wenn du es mit dem Registry-Eintrag "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" startest, dann findet dein Script die Ini-Datei nicht?!

    Dann hast du wahrscheinlich @Scriptdir vergessen: IniRead(@Scriptdir & "\IniDatei.ini...

    Auch blöde Frage: Schreibst du an deinem Script auch mit der Bildschirmtastatur? :D

    lgE

  • Bitrate einer MP3-Datei auslesen

    • eukalyptus
    • 12. September 2008 um 11:41

    Hatte gerade mit einer VBR-Mp3 zu tun und mir ist folgendes aufgefallen:

    Die Mp3 hatte eine durchschnittliche Bitrate von 158kbit/s.
    VlC zeigte 128kbit/s, Windows 224kbit/s an! Beides konnte nicht stimmen.

    Die einfachste Möglichkeit, an die druchschnittliche Bitrate zu kommen, ist nun folgende:

    Spoiler anzeigen
    [autoit]

    #include "ExtProp.au3"
    $Mp3 = FileOpenDialog("Wähle eine Mp3-Datei aus", "", "Mp3 (*.mp3)", 1)
    $Size = FileGetSize($Mp3)
    $Length = _GetExtProperty($Mp3, 21)
    $Split = StringSplit($Length, ":")
    If @error Then Exit
    $Sec = Int($Split[3])
    $Sec += Int($Split[2]) * 60
    $Sec += Int($Split[1]) * 60 * 60
    $Bitrate = Round($Size / 1024 / $Sec * 8)
    MsgBox(0, $Mp3, $Bitrate)

    [/autoit]

    Die Bitrate wird anhand der Länge und Größe der Mp3 ausgerechnet
    $Size / 1024 : von Byte zu Kilobyte
    / Sec : Kilobyte pro Sekunde
    *8 : kiloByte zu KiloBit

    Allerdings ist das nur ein Näherungswert, da hier auch die ID3-Tags mitgerechnet werden!
    Ich glaube ITunes speichert hier gern Bilder in die Mp3 - ein 5s Lied mit einem ID3v2-Tag von 8mb verfälscht das Ergebnis natürlich sehr ;)

    ExtProp.au3

    Spoiler anzeigen
    [autoit]

    ;===============================================================================
    ; Function Name: GetExtProperty($sPath,$iProp)
    ; Description: Returns an extended property of a given file.
    ; Parameter(s): $sPath - The path to the file you are attempting to retrieve an extended property from.
    ; $iProp - The numerical value for the property you want returned. If $iProp is is set
    ; to -1 then all properties will be returned in a 1 dimensional array in their corresponding order.
    ; The properties are as follows:
    ; Name = 0
    ; Size = 1
    ; Type = 2
    ; DateModified = 3
    ; DateCreated = 4
    ; DateAccessed = 5
    ; Attributes = 6
    ; Status = 7
    ; Owner = 8
    ; Author = 9
    ; Title = 10
    ; Subject = 11
    ; Category = 12
    ; Pages = 13
    ; Comments = 14
    ; Copyright = 15
    ; Artist = 16
    ; AlbumTitle = 17
    ; Year = 18
    ; TrackNumber = 19
    ; Genre = 20
    ; Duration = 21
    ; BitRate = 22
    ; Protected = 23
    ; CameraModel = 24
    ; DatePictureTaken = 25
    ; Dimensions = 26
    ; Width = 27
    ; Height = 28
    ; Company = 30
    ; Description = 31
    ; FileVersion = 32
    ; ProductName = 33
    ; ProductVersion = 34
    ; Requirement(s): File specified in $spath must exist.
    ; Return Value(s): On Success - The extended file property, or if $iProp = -1 then an array with all properties
    ; On Failure - 0, @Error - 1 (If file does not exist)
    ; Author(s): Simucal ([email='Simucal@gmail.com'][/email])
    ; Note(s):
    ;
    ;===============================================================================
    Func _GetExtProperty($sPath, $iProp)
    Local $iExist, $sFile, $sDir, $oShellApp, $oDir, $oFile, $aProperty, $sProperty
    $iExist = FileExists($sPath)
    If $iExist = 0 Then
    SetError(1)
    Return 0
    Else
    $sFile = StringTrimLeft($sPath, StringInStr($sPath, "\", 0, -1))
    $sDir = StringTrimRight($sPath, (StringLen($sPath) - StringInStr($sPath, "\", 0, -1)))
    $oShellApp = ObjCreate ("shell.application")
    $oDir = $oShellApp.NameSpace ($sDir)
    $oFile = $oDir.Parsename ($sFile)
    If $iProp = -1 Then
    Local $aProperty[35]
    For $i = 0 To 34
    $aProperty[$i] = $oDir.GetDetailsOf ($oFile, $i)
    Next
    Return $aProperty
    Else
    $sProperty = $oDir.GetDetailsOf ($oFile, $iProp)
    If $sProperty = "" Then
    Return 0
    Else
    Return $sProperty
    EndIf
    EndIf
    EndIf
    EndFunc ;==>_GetExtProperty

    [/autoit]

    lgE

  • Bild , aber davor noch ein Bild

    • eukalyptus
    • 10. September 2008 um 11:32
    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $Bild = @DocumentsCommonDir & "\Eigene Bilder\Beispielbilder\Sonnenuntergang.jpg"
    ;$Bild=@ScriptDir & "\Test.bmp"

    [/autoit] [autoit][/autoit] [autoit]

    GUICreate("Bild", 800, 600)
    $hPic = GUICtrlCreatePic($Bild, 0, 0, 800, 600)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()
    $hImage = _GDIPlus_ImageLoadFromFile($Bild)
    $hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage)
    $IMGX = _GDIPlus_ImageGetWidth($hImage)
    $IMGY = _GDIPlus_ImageGetHeight($hImage)
    $hFormat = _GDIPlus_StringFormatCreate()
    $hFamily = _GDIPlus_FontFamilyCreate("Arial")
    $hFont = _GDIPlus_FontCreate($hFamily, 50, 1)

    [/autoit] [autoit][/autoit] [autoit]

    For $Zahlen = 0 To 31
    $hBrush = _GDIPlus_BrushCreateSolid("0x" & _RC() & _RC() & _RC() & _RC())
    $tLayout = _GDIPlus_RectFCreate(Mod($Zahlen, 8) * $IMGX / 8, Floor($Zahlen / 8) * $IMGY / 4, 100, 100)
    _GDIPlus_GraphicsDrawStringEx($hGraphics, $Zahlen + 1, $hFont, $tLayout, $hFormat, $hBrush)
    Next

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_ImageSaveToFile($hImage, @ScriptDir & "\Neu.bmp")
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_GraphicsDispose($hGraphics)
    GUICtrlSetImage($hPic, @ScriptDir & "\Neu.bmp")
    MsgBox(0, "", "Fertig")

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Shutdown()

    [/autoit] [autoit][/autoit] [autoit]

    Func _RC()
    Return StringRight(Hex(Random(100, 255, 1)), 2)
    EndFunc

    [/autoit]

    $hBrush = _GDIPlus_BrushCreateSolid:
    0x11223344
    11=Transparenz
    22=Rot
    33=Grün
    44=Blau
    Alle von 00 bis FF

    lgE

  • µit - September

    • eukalyptus
    • 9. September 2008 um 22:11
    Zitat von BugFix

    Naja, in diese Minimalbereiche kann ich mit meiner Methode nicht vorstoßen - die ist bei 0.12 ausgereizt.
    Und solange mir kein anderer Algorithmus einfällt bleibt es also dabei. :S

    Bin ja gespannt, wie man multipliziert ohne zu addieren. Letztlich liegt doch jeder Rechenoperation eine Addition zugrunde. :wacko:

    Ich hab ja nicht behauptet NICHT zu addieren, sondern ich verzichte auf _BigInt_Add!
    Na, klingelt´s?
    :rolleyes:

  • Dlls

    • eukalyptus
    • 9. September 2008 um 22:07

    Ich kenn die Programmiersprache auch nicht, aber "declspec" könnte doch folgendes bedeuten:

    Code
    Function DllCallBy default, AutoIt uses the 'stdcall' calling method. To use the 'cdecl' method  place ':cdecl' after the return type.
    DllCall("SQLite.dll", "int:cdecl",  "sqlite3_open", "str", $sDatabase_Filename , "long*", 0).

    also evtl:

    [autoit]

    $dll = DllOpen("add.dll")
    $c = DllCall($dll,"double:cdecl","AddNumbers","double",$a,"double",$b)

    [/autoit]

    lgE

  • Bild , aber davor noch ein Bild

    • eukalyptus
    • 9. September 2008 um 21:58

    Hi

    würde dir vielleicht sowas helfen?

    Spoiler anzeigen
    [autoit]

    #Include <GDIPlus.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $Bild=@DocumentsCommonDir & "\Eigene Bilder\Beispielbilder\Sonnenuntergang.jpg"
    ;$Bild=@ScriptDir & "\Test.bmp"

    [/autoit] [autoit][/autoit] [autoit]

    GUICreate("Bild",800,600)
    $hPic=GUICtrlCreatePic($Bild,0,0,800,600)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup ()

    [/autoit] [autoit][/autoit] [autoit]

    For $Zahlen=1 to 5
    $hImage = _GDIPlus_ImageLoadFromFile($Bild)
    $hGraphics = _GDIPlus_ImageGetGraphicsContext ($hImage)
    $IMGX=_GDIPlus_ImageGetWidth($hImage)
    $IMGY=_GDIPlus_ImageGetHeight($hImage)
    $hBrush = _GDIPlus_BrushCreateSolid (0x7F00FF00)
    $hFormat = _GDIPlus_StringFormatCreate ()
    $hFamily = _GDIPlus_FontFamilyCreate ("Arial")
    $hFont = _GDIPlus_FontCreate ($hFamily, 200, 1)
    $tLayout = _GDIPlus_RectFCreate (10, 10, $IMGX, $IMGY)
    _GDIPlus_GraphicsDrawStringEx ($hGraphics, $Zahlen,$hFont,$tLayout, $hFormat, $hBrush)
    _GDIPlus_ImageSaveToFile($hImage,@ScriptDir & "\Neu.bmp")
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_GraphicsDispose($hGraphics)
    GUICtrlSetImage($hPic,@ScriptDir & "\Neu.bmp")
    Sleep(1000)
    Next

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Shutdown()

    [/autoit]


    (falls beim Testlauf kein Bild angezeigt wird, dann kopiere einfach ein Test.bmp ins Scriptverzeichnis und gib das ";" bei Zeile 4 weg)

    Die Zahlen können auch andere Farben haben, bzw nicht transparent sein...

    vielleicht wär es ganz gut, wenn du schreiben könntest, wofür du das dann benötigst...

    lgE

  • µit - September

    • eukalyptus
    • 9. September 2008 um 21:47

    Naja, ICH bin am ende.
    Wenn du, Pee, mein Script siehst, kannst du sicher noch ein paar ms rausholen, aber ich hab mein maximum erreicht!
    und solltest du bis zum Abgabetermin noch die mathematischen Feinheiten rausfinden, welche ich (und ich glaube auch Oscar) ausnützen, dann seh ich schwarz für mich ;)

    Ansonsten: Pack doch einfach die Zeile "$Time=Timerinit()" in dein Script und schon bist du der Schnellste! :rofl:

    Ich geb euch mal ein paar Hinweise:

    Ich verwende die Schulmethode, allerdings etwas umgeformt.
    Mein Script würde fehlerhaft laufen, wenn z.b. eine Zahl den Wert 9999999999999999999999 hätte.
    Ich verwende bei _BigInt_Mul NICHT _BigIntAdd.
    Nur bei einer der beiden Funktionen splite ich die Zahl in ein Array.

    Das war jetzt wahrscheinlich schon zuviel!

    lgE

  • µit - September

    • eukalyptus
    • 9. September 2008 um 20:30

    Danke für die Auswertung!

    UND: ich leg gleich nochmals nach:

    aktueller SpeedWert:
    *trommelwirbel*
    0.027 (0.019 ADD 0.008 MUL)

    bei Walle darf ich da mit etwa 0.025 rechnen!!!

    Ich hoffe, ich verderbe jetzt niemanden den Spaß und hoffe doch sehr, daß ihr mich noch jagen werdet!
    für mich war es jedenfalls die letzte Optimierung, mehr geht nicht - das ende der Fahnenstange ist definitiv erreicht!

    lgE

  • Hilfe Videos

    • eukalyptus
    • 8. September 2008 um 19:12
    Zitat von Tom99

    Das Video ist echt Klasse :)
    Dann werd ich mal ein Video zu Regulären Ausdrücken machen.

    JA BITTE!
    Reguläre Ausdrücke sind für mich immer noch ein Buch mit 7 Siegeln! ;(

  • Mediaplayer der mehrere Formate abspielen kann

    • eukalyptus
    • 7. September 2008 um 23:24

    Andererseits bin ich mit der Lösung aus dem englischen Forum ganz zufrieden;)
    Das reicht für meine Zwecke, und vielleicht auch für den Thread-Starter?

    Example

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <SliderConstants.au3>
    #include <Constants.au3>
    #include "MCI_Video.au3"

    [/autoit] [autoit][/autoit] [autoit]

    Global $sVideoFile, $vID
    Global $ApW = 350, $ApH = 350
    Global $Hotkey, $FullScreen, $Vol = 100, $Paused

    [/autoit] [autoit][/autoit] [autoit]

    $hGui = GUICreate("My Video Player", $ApW, $ApH, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_CLIPCHILDREN))
    GUISetBkColor(0x000000, $hGui)

    [/autoit] [autoit][/autoit] [autoit]

    $FileMenu = GUICtrlCreateMenu("&File")
    $FileOpen = GUICtrlCreateMenuItem("&Open" & @TAB & "Ctrl+O", $FileMenu)
    $FileClose = GUICtrlCreateMenuItem("&Close" & @TAB & "Ctrl+C", $FileMenu)
    GUICtrlCreateMenuItem("", $FileMenu)
    $FileExit = GUICtrlCreateMenuItem("E&xit" & @TAB & "Esc", $FileMenu)

    [/autoit] [autoit][/autoit] [autoit]

    $ViewMenu = GUICtrlCreateMenu("&View")
    $ViewFullScreen = GUICtrlCreateMenuItem("Full Screen" & @TAB & "Alt+Enter", $ViewMenu)
    $ViewTopMost = GUICtrlCreateMenuItem("Topmost" & @TAB & "Alt+T", $ViewMenu)

    [/autoit] [autoit][/autoit] [autoit]

    $PlayMenu = GUICtrlCreateMenu("&Play")
    $PlayPause = GUICtrlCreateMenuItem("&Play/Pause" & @TAB & "Space", $PlayMenu)
    $PlayStop = GUICtrlCreateMenuItem("&Stop" & @TAB & "Period", $PlayMenu)
    GUICtrlCreateMenuItem("", $PlayMenu)
    $PlaySNS = GUICtrlCreateMenuItem("Slide &N Seek" & @TAB & "Ctrl+N", $PlayMenu)
    GUICtrlCreateMenuItem("", $PlayMenu)
    $PlayMute = GUICtrlCreateMenuItem("&Mute" & @TAB & "Ctrl+M", $PlayMenu)
    $Seek = GUICtrlCreateSlider(0, $ApH - 69, $ApW, 27, BitOR($TBS_NOTICKS, $TBS_BOTH))
    GUICtrlSetLimit(-1, 200, 0)
    GUICtrlSetResizing(-1, 576)
    GUICtrlSetBkColor(-1, 0x000000)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $LableSeek = GUICtrlCreateLabel("Time: 00:00:00 / 00:00:00", 8, $ApH - 39, $ApW - 166, 16)
    GUICtrlSetFont(-1, 9, 700)
    GUICtrlSetResizing(-1, 834)
    GUICtrlSetColor(-1, 0x00ff00)

    [/autoit] [autoit][/autoit] [autoit]

    $LableVol = GUICtrlCreateLabel(" Volume: 100", $ApW - 156, $ApH - 39, 74, 16)
    GUICtrlSetFont(-1, 9, 700)
    GUICtrlSetResizing(-1, 836)
    GUICtrlSetColor(-1, 0x00ff00)
    $Volume = GUICtrlCreateSlider($ApW - 81, $ApH - 41, 80, 20, BitOR($TBS_NOTICKS, $TBS_BOTH))
    GUICtrlSetLimit(-1, 100, 0)
    GUICtrlSetData(-1, $Vol)
    GUICtrlSetResizing(-1, 832)
    GUICtrlSetBkColor(-1, 0x000000)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW, $hGui)

    [/autoit] [autoit][/autoit] [autoit]

    $WGP = WinGetPos($hGui)
    $ApW = $WGP[2]
    $ApH = $WGP[3]

    [/autoit] [autoit][/autoit] [autoit]

    AdlibEnable("CheckEvents", 250)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $msg = GUIGetMsg()
    Switch $msg
    Case $GUI_EVENT_CLOSE, $FileExit
    Quit()
    Case $FileOpen
    OpenFile()
    Case $FileClose
    CloseFile()
    Case $ViewFullScreen
    ToggleFullScreen()
    Case $ViewTopMost
    ToggleTopmost()
    Case $PlayPause
    TogglePause()
    Case $PlayStop
    Stop()
    Case $PlaySNS
    SlideNSeek()
    Case $PlayMute
    Mute()
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func CheckEvents()
    ;Set and Unset hotkeys
    If WinActive($hGui) And Not $Hotkey Then
    SetHotkeys()
    ElseIf Not WinActive($hGui) And $Hotkey Then
    SetHotkeys()
    EndIf

    ;Set Volume
    If $Vol <> GUICtrlRead($Volume) Then
    $Vol = GUICtrlRead($Volume)
    GUICtrlSetData($LableVol, " Volume: " & $Vol)
    _Video_Volume($vID, $Vol)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ;Set seeking
    Local $GGCI = GUIGetCursorInfo($hGui)
    If IsArray($GGCI) And Not $GGCI[2] And $vID <> "" Then
    GUICtrlSetData($LableSeek, "Time: " & _Video_TimePos($vID) & " / " & _Video_Length($vID))
    GUICtrlSetData($Seek, (200 / _Video_Length($vID, 1)) * _Video_TimePos($vID, 1))
    EndIf
    If IsArray($GGCI) And $GGCI[4] = $Seek And $GGCI[2] And $vID <> "" Then
    Local $SeekPos
    While $GGCI[2]
    $GGCI = GUIGetCursorInfo($hGui)
    $SeekPos = Round((_Video_Length($vID, 1) * GUICtrlRead($Seek)) / 200)
    If BitAND(GUICtrlRead($PlaySNS), $GUI_CHECKED) Then
    _Video_Seek($vID, $SeekPos)
    GUICtrlSetData($LableSeek, "Time: " & _Video_TimePos($vID) & " / " & _Video_Length($vID))
    Else
    GUICtrlSetData($LableSeek, "Time: " & _MSToHMS($SeekPos) & " / " & _Video_Length($vID))
    EndIf
    Sleep(10)
    WEnd
    If BitAND(GUICtrlRead($PlaySNS), $GUI_UNCHECKED) Then _Video_Seek($vID, $SeekPos)
    If Not $Paused Then TogglePause()
    EndIf
    EndFunc ;==>CheckEvents

    [/autoit] [autoit][/autoit] [autoit]

    Func Stop()
    _Video_Stop($vID)
    EndFunc ;==>Stop

    [/autoit] [autoit][/autoit] [autoit]

    Func SetHotkeys()
    If $Hotkey Then
    $Hotkey = 0
    HotKeySet("^c")
    HotKeySet("^m")
    HotKeySet("^n")
    HotKeySet("^o")
    HotKeySet("^.")
    HotKeySet("!t")
    HotKeySet("{SPACE}")
    Else
    $Hotkey = 1
    HotKeySet("^c", "CloseFile")
    HotKeySet("^m", "Mute")
    HotKeySet("^n", "SlideNSeek")
    HotKeySet("^o", "OpenFile")
    HotKeySet(".", "Stop")
    HotKeySet("!{ENTER}", 'ToggleFullScreen')
    HotKeySet("!t", 'HkTopmost')
    HotKeySet("{SPACE}", "TogglePause")
    EndIf
    EndFunc ;==>SetHotkeys

    [/autoit] [autoit][/autoit] [autoit]

    Func OpenFile()
    Local $FOD = FileOpenDialog("Select a video to play.", "", "Video (*.avi;*.mpg;*.mpg;*.wmv)", 3)
    If Not @error Then
    If _Video_Status($vID) <> "" Then _Video_Close($vID)
    $sVideoFile = $FOD
    Local $aWH = _Video_Dimension($sVideoFile), $iX, $iY
    $vID = _Video_Open($sVideoFile, $hGui, 0, 0, $aWH[0], $aWH[1], "MPEGVideo")
    $iX = (@DesktopWidth / 2) - ($aWH[0] / 2)
    $iY = ((@DesktopHeight / 2) - ($aWH[1] / 2)) - 50
    SetWindowPos($hGui, 0, $iX, $iY, $aWH[0], $aWH[1] + 100, 0x64)
    _Video_Volume($vID, $Vol)
    _Video_Play($vID)
    GUICtrlSetState($Seek, $GUI_ENABLE)
    EndIf
    EndFunc ;==>OpenFile

    [/autoit] [autoit][/autoit] [autoit]

    Func CloseFile()
    _Video_Close($vID)
    $sVideoFile = ""
    GUICtrlSetState($Seek, $GUI_DISABLE)
    GUICtrlSetData($LableSeek, "Time: 00:00:00 / 00:00:00")
    WinMove($hGui, "", (@DesktopWidth / 2) - ($ApW / 2), ((@DesktopHeight / 2) - ($ApH / 2)), $ApW, $ApH)
    EndFunc ;==>CloseFile

    [/autoit] [autoit][/autoit] [autoit]

    Func ToggleFullScreen()
    If $FullScreen Then
    $FullScreen = 0
    _Video_Play($vID)
    SetWindowPos($hGui, ToggleTopmost(1), 0, 0, 0, 0, 0x63)
    Else
    $FullScreen = 1
    SetWindowPos($hGui, -1, 0, 0, 0, 0, 0x43)
    _Video_Play($vID, 1)
    EndIf
    EndFunc ;==>ToggleFullScreen

    [/autoit] [autoit][/autoit] [autoit]

    Func HkTopmost()
    ToggleTopmost()
    EndFunc ;==>HkTopmost

    [/autoit] [autoit][/autoit] [autoit]

    Func ToggleTopmost($iState = 0)
    If BitAND(GUICtrlRead($ViewTopMost), $GUI_CHECKED) Then
    If Not $iState Then
    SetWindowPos($hGui, -2, 0, 0, 0, 0, 0x43)
    GUICtrlSetState($ViewTopMost, $GUI_UNCHECKED)
    Else
    Return -1
    EndIf
    Else
    If Not $iState Then
    SetWindowPos($hGui, -1, 0, 0, 0, 0, 0x43)
    GUICtrlSetState($ViewTopMost, $GUI_CHECKED)
    Else
    Return -2
    EndIf
    EndIf
    EndFunc ;==>ToggleTopmost

    [/autoit] [autoit][/autoit] [autoit]

    Func TogglePause()
    Switch _Video_Status($vID)
    Case "playing"
    _Video_Pause($vID)
    $Paused = 1
    Case "paused"
    _Video_Resume($vID)
    $Paused = 0
    Case "stopped"
    _Video_Play($vID)
    $Paused = 0
    EndSwitch
    EndFunc ;==>TogglePause

    [/autoit] [autoit][/autoit] [autoit]

    Func SlideNSeek()
    If BitAND(GUICtrlRead($PlaySNS), $GUI_CHECKED) Then
    GUICtrlSetState($PlaySNS, $GUI_UNCHECKED)
    Else
    GUICtrlSetState($PlaySNS, $GUI_CHECKED)
    EndIf
    EndFunc ;==>SlideNSeek

    [/autoit] [autoit][/autoit] [autoit]

    Func Mute()
    Switch _Video_Status($vID, "audio")
    Case "off"
    _Video_Mute($vID)
    Case "on"
    _Video_Mute($vID, 1)
    EndSwitch
    EndFunc ;==>Mute

    [/autoit] [autoit][/autoit] [autoit]

    Func Quit()
    _Video_Close($vID)
    Exit
    EndFunc ;==>Quit

    [/autoit] [autoit][/autoit] [autoit]

    Func SetWindowPos($hWnd, $hAfter, $iX, $iY, $iCX, $iCY, $iFlags)
    DllCall("User32.dll", "int", "SetWindowPos", "hwnd", $hWnd, "hwnd", $hAfter, _
    "int", $iX, "int", $iY, "int", $iCX, "int", $iCY, "int", $iFlags)
    EndFunc ;==>SetWindowPos

    [/autoit]

    UDF:

    Spoiler anzeigen
    [autoit]

    #include-once

    [/autoit] [autoit][/autoit] [autoit]

    ; #CURRENT# ===============================================================================================
    ; _Video_Close
    ; _Video_Dimension
    ; _Video_FrameRate
    ; _Video_Length
    ; _Video_Mute
    ; _Video_Open
    ; _Video_Pause
    ; _Video_Play
    ; _Video_Resume
    ; _Video_Seek
    ; _Video_Status
    ; _Video_Step
    ; _Video_Stop
    ; _Video_TimePos
    ; _Video_Volume
    ; _RandomStr
    ; _MSToHMS
    ; _mciDeviceExists
    ; _mciListDevices
    ; _mciSendString
    ;==========================================================================================================

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ==============================================================================================
    ; Name...........: _Video_Close
    ; Description....: Close a video.
    ; Syntax.........: _Video_Close($sAlias)
    ; Parameters ....: $sAlias - Alias name returned by _Video_Open.
    ; Return values .: Success - Return 1 and sets Alias name to "".
    ; Failure - Return 0 and @error 1~2
    ; @error 1 = Invalid Alias
    ; @error 2 = MCI failed to close video
    ; Author ........: smashly
    ; =========================================================================================================
    Func _Video_Close(ByRef $sAlias)
    If $sAlias = "" Or StringRegExp($sAlias, "\W|_", 0) Then Return SetError(1, 0, 0)
    If _mciSendString("close " & $sAlias) = 0 Then
    $sAlias = ""
    Return SetError(0, 0, 1)
    Else
    Return SetError(2, 0, 0)
    EndIf
    EndFunc ;==>_Video_Close

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ==============================================================================================
    ; Name...........: _Video_Dimension
    ; Description....: Retrieves the Width and Height of the source video.
    ; Syntax.........: _Video_Dimension($sFile)
    ; Parameters ....: $sFile - The full path to video file.
    ; Return values .: Success - Returns an array. array[0] = Width, array[1] = Height
    ; Failure - Return 0 and @error 1~3
    ; @error 1 = File doesn't exist.
    ; @error 2 = MCI failed to open the video file.
    ; @error 3 = MCI failed to get the source video dimensions.
    ; Author ........: smashly
    ; =========================================================================================================
    Func _Video_Dimension($sFile)
    Local $iRet, $sVID, $aTmp
    If Not FileExists($sFile) Then Return SetError(1, 0, 0)
    $sVID = _RandomStr()
    $iRet = _mciSendString("open " & FileGetShortName($sFile) & " alias " & $sVID)
    If $iRet <> 0 Then Return SetError(2, 0, 0)
    $iRet = _mciSendString("where " & $sVID & " source", 255)
    If $iRet = "" Then
    _mciSendString("close " & $sVID)
    Return SetError(3, 0, 0)
    EndIf
    _mciSendString("close " & $sVID)
    $aTmp = StringSplit($iRet, Chr(32))
    $aTmp[1] = $aTmp[$aTmp[0]]
    $aTmp[0] = $aTmp[$aTmp[0] - 1]
    ReDim $aTmp[2]
    Return $aTmp
    EndFunc ;==>_Video_Dimension

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ==============================================================================================
    ; Name...........: _Video_FrameRate
    ; Description....: Close a video.
    ; Syntax.........: _Video_FrameRate($sAlias)
    ; Parameters ....: $sAlias - Alias name returned by _Video_Open.
    ; Return values .: Success - Returns the Frames Per Second of the video.
    ; Failure - Return 0 and @error 1
    ; @error 1 = Invalid Alias
    ; Author ........: smashly
    ; =========================================================================================================
    Func _Video_FrameRate($sAlias)
    If $sAlias = "" Or StringRegExp($sAlias, "\W|_", 0) Then Return SetError(1, 0, 0)
    Return _mciSendString("status " & $sAlias & " nominal frame rate", 255) / 1000
    EndFunc ;==>_Video_FrameRate

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ==============================================================================================
    ; Name...........: _Video_Length
    ; Description....: Get the time length of a video in Milliseconds or Hours, Minutes, Seconds (HH:MM:SS)
    ; Syntax.........: _Video_Length($sAlias[, $iTime = 0])
    ; Parameters ....: $sAlias - Alias name returned by _Video_Open
    ; $iTime - 0 Return time lenth in Hours, Minutes, Seconds (HH:MM:SS)
    ; - 1 Return time lenth in Milliseconds.
    ; Return values .: Success - Return time length in Milliseconds or Hours, Minutes, Seconds (HH:MM:SS)
    ; Failure - Return 0 and @error 1
    ; @error 1 = Invalid Alias
    ; Author ........: smashly
    ; =========================================================================================================
    Func _Video_Length($sAlias, $iTime = 0)
    Local $iMS
    If $sAlias = "" Or StringRegExp($sAlias, "\W|_", 0) Then Return SetError(1, 0, 0)
    _mciSendString("set " & $sAlias & " time format ms")
    $iMS = _mciSendString("status " & $sAlias & " length", 255)
    If Not $iTime Then Return _MSToHMS($iMS)
    If $iTime Then Return $iMS
    EndFunc ;==>_Video_Length

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ==============================================================================================
    ; Name...........: _Video_Mute
    ; Description....: Turn off/on the audio in a video.
    ; Syntax.........: _Video_Mute($sAlias[, $iMute = 0])
    ; Parameters ....: $sAlias - Alias name returned by _Video_Open.
    ; $iAudio - 0 = Audio On, 1 = Audio Off
    ; Return values .: Success - Return 1 and @error 0
    ; Failure - Return 0 and @error 1~2
    ; @error 1 = Invalid Alias
    ; @error 2 = MCI failed to turn the video audio off/on
    ; Author ........: smashly
    ; =========================================================================================================
    Func _Video_Mute($sAlias, $iMute = 0)
    Local $iRet, $iAM = "on"
    If $sAlias = "" Or StringRegExp($sAlias, "\W|_", 0) Then Return SetError(1, 0, 0)
    If $iMute Then $iAM = "off"
    $iRet = _mciSendString("set " & $sAlias & " audio all " & $iAM)
    If $iRet = 0 Then
    Return SetError(0, 0, 1)
    Else
    Return SetError(2, 0, 0)
    EndIf
    EndFunc ;==>_Video_Mute

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ==============================================================================================
    ; Name...........: _Video_Open
    ; Description ...: Opens a Video file ready for use with other _Video_xxxx functions.
    ; Syntax.........: _Video_Open($sFile, $hWnd, $iX, $iY, $iW, $iH[, $sDevice = ""])
    ; Parameters ....: $sFile - The full path to video file.
    ; $hWnd - Handle to a window or control that the video will be displayed on
    ; $iX - Left position of the video.
    ; $iY - Top position of the video.
    ; $iW - Width of the video.
    ; $iH - Height of the video.
    ; $sDevice - MCI Device type to play video with. (See Remarks for more info)
    ; Return values .: Success - Return an Alias name for use with other _Video_xxxx functions.
    ; Failure - Return an empty String "" and @error 1~5
    ; @error 1 = File doesn't exist
    ; @error 2 = Window or Control handle not valid.
    ; @error 3 = Invalid MCI Device type specified.
    ; @error 4 = MCI failed to open video file
    ; @error 5 = MCI failed window for video.
    ; @error 5 = MCI failed to put video at the deignated location.
    ; Author ........: smashly
    ; Remarks .......: If your having trouble with avi playback (eg; playing fast, slow, choppy or no audio)
    ; or a video won't play but it plays fine in any other player ...
    ; Then set the $sDevice parameter to "MPEGVideo"
    ; If the $sDevice parameter is left blank then windows will decide which MCI Device type
    ; to use.
    ; Most current day avi/wmv/mp4 formats dont play properly or at all when windows selects
    ; the mci device type to use.
    ; Windows would default use "AVIVideo" MCI Device type to play avi with mci.
    ; When you specify "MPEGVideo" for an avi and mci fails it then uses the windows native
    ; chain of codecs that would be used by any other player not using mci ;)
    ; Because of this behaviour you can usually play almost any type of video that normally
    ; fails when using mci just by specifying "MPEGVideo" mci device type.
    ; For playing video on an autoit gui then be sure to add the $WS_CLIPCHILDREN style
    ; to your Gui. This will keep the Video dislpayed on your Gui all the time.
    ; =========================================================================================================
    Func _Video_Open($sFile, $hWnd, $iX, $iY, $iH, $iW, $sDevice = "")
    Local $sVID, $gId, $iRet, $sDT = ""
    If Not FileExists($sFile) Then Return SetError(1, 0, "")
    If Not IsHWnd($hWnd) Then Return SetError(2, 0, "")
    If $sDevice <> "" Then
    If Not _mciDeviceExists($sDevice) Then Return SetError(3, 0, "")
    $sDT = " type " & $sDevice
    EndIf
    $gId = Dec(StringTrimLeft($hWnd, 2))
    $sVID = _RandomStr()
    $iRet = _mciSendString("open " & FileGetShortName($sFile) & " alias " & $sVID & $sDT)
    If $iRet <> 0 Then Return SetError(4, 0, "")
    $iRet = _mciSendString("window " & $sVID & " handle " & $gId)
    If $iRet <> 0 Then
    _mciSendString("close " & $sVID)
    Return SetError(5, 0, "")
    EndIf
    $iRet = _mciSendString("put " & $sVID & " destination at " & $iX & " " & $iY & " " & $iH & " " & $iW)
    If $iRet <> 0 Then
    _mciSendString("close " & $sVID)
    Return SetError(6, 0, "")
    EndIf
    Return SetError(0, 0, $sVID)
    EndFunc ;==>_Video_Open

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ==============================================================================================
    ; Name...........: _Video_Pause
    ; Description....: Pause a Video at the current playing position.
    ; Syntax.........: _Video_Pause($sAlias)
    ; Parameters ....: $sAlias - Alias name returned by _Video_Open.
    ; Return values .: Success - Return 1 and @error 0
    ; Failure - Return 0 and @error 1~2
    ; @error 1 = Invalid Alias
    ; @error 2 = Failed to pause video.
    ; Author ........: smashly
    ; =========================================================================================================
    Func _Video_Pause($sAlias)
    Local $iRet
    If $sAlias = "" Or StringRegExp($sAlias, "\W|_", 0) Then Return SetError(1, 0, 0)
    $iRet = _mciSendString("pause " & $sAlias)
    If $iRet = 0 Then
    Return SetError(0, 0, 1)
    Else
    Return SetError(2, 0, 0)
    EndIf
    EndFunc ;==>_Video_Pause

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ==============================================================================================
    ; Name...........: _Video_Play
    ; Description....: Plays a Video from the current position.
    ; Syntax.........: _Video_Play($sAlias[, $iMode = 0])
    ; Parameters ....: $sAlias - Alias name returned by _Video_Open.
    ; $iMode - 0 play video on the window or control as specified in _Video_Open
    ; - 1 play video in Fullscreen mode.
    ; Return values .: Success - Return 1 and @error 0
    ; Failure - Return 0 and @error 1~2
    ; @error 1 = Invalid Alias
    ; @error 2 = MCI failed to play video.
    ; Author ........: smashly
    ; =========================================================================================================
    Func _Video_Play($sAlias, $iMode = 0)
    Local $iRet
    If $sAlias = "" Or StringRegExp($sAlias, "\W|_", 0) Then Return SetError(1, 0, 0)
    If _Video_TimePos($sAlias, 1) = _Video_Length($sAlias, 1) Then _Video_Seek($sAlias, "start")
    If $iMode Then
    $vRet = _mciSendString("play " & $sAlias & " fullscreen")
    Else
    $iRet = _mciSendString("play " & $sAlias)
    EndIf
    If $iRet = 0 Then
    Return SetError(0, 0, 1)
    Else
    Return SetError(1, 0, 0)
    EndIf
    EndFunc ;==>_Video_Play

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ==============================================================================================
    ; Name...........: _Video_Resume
    ; Description....: Resume playing a video after pausing.
    ; Syntax.........: _Video_Resume($sAlias)
    ; Parameters ....: $sAlias - Alias name returned by _Video_Open.
    ; Return values .: Success - Return 1 and @error 0
    ; Failure - Return 0 and @error 1~2
    ; @error 1 = Invalid Alias
    ; @error 2 = MCI failed to resume video.
    ; Author ........: smashly
    ; =========================================================================================================
    Func _Video_Resume($sAlias)
    Local $iRet
    If $sAlias = "" Or StringRegExp($sAlias, "\W|_", 0) Then Return SetError(1, 0, 0)
    $iRet = _mciSendString("resume " & $sAlias)
    If $iRet = 0 Then
    Return SetError(0, 0, 1)
    Else
    Return SetError(2, 0, 0)
    EndIf
    EndFunc ;==>_Video_Resume

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ==============================================================================================
    ; Name...........: _Video_Seek
    ; Description....: Seek a video to the specified time position.
    ; Syntax.........: _Video_Seek($sAlias, $iTime)
    ; Parameters ....: $sAlias - Alias name returned by _Video_Open.
    ; $iTime - Time to Seek. Can be Millisecons or HH:MM:SS or "start" or "end"
    ; Return values .: Success - Return 1 and @error 0
    ; Failure - Return 0 and @error 1~3
    ; @error 1 = Invalid Alias
    ; @error 2 = Invalid time format.
    ; @error 3 = MCI Seek error
    ; Author ........: smashly
    ; =========================================================================================================
    Func _Video_Seek($sAlias, $iTime)
    Local $iMS, $aTime, $iRet
    If $sAlias = "" Or StringRegExp($sAlias, "\W|_", 0) Then Return SetError(1, 0, 0)
    If StringInStr($iTime, ":") Then
    $aTime = StringSplit($iTime, ":")
    If $aTime[0] <> 3 Then Return SetError(2, 0, 0)
    $iMS = 1000 * ((3600 * $aTime[1]) + (60 * $aTime[2]) + $aTime[3])
    ElseIf StringIsInt($iTime) Or $iTime = "start" Or $iTime = "end" Then
    $iMS = $iTime
    Else
    Return SetError(2, 0, 0)
    EndIf
    _mciSendString("set " & $sAlias & " time format ms")
    $iRet = _mciSendString("seek " & $sAlias & " to " & $iMS)
    If $iRet = 0 Then
    Return SetError(0, 0, 1)
    Else
    Return SetError(3, 0, 0)
    EndIf
    EndFunc ;==>_Video_Seek

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ==============================================================================================
    ; Name...........: _Video_Status
    ; Description....: Get a status status message from a video device.
    ; Syntax.........: _Video_Status($sAlias[, $sQuery = "mode"])
    ; Parameters ....: $sAlias - Alias name returned by _Video_Open
    ; $sQuery - What to get the status of:
    ; "audio" - returns the "on" or "off"
    ; "mode" - returns "paused", "playing" and "stopped"
    ; Return values .: Success - Returns a Status message from the video device.
    ; Failure - Return 0 and @error 1
    ; @error 1 = Invalid Alias
    ; @error 2 = Invalid query (To be implemented)
    ; Author ........: smashly
    ; =========================================================================================================
    Func _Video_Status($sAlias, $sQuery = "mode")
    If $sAlias = "" Or StringRegExp($sAlias, "\W|_", 0) Then Return SetError(1, 0, 0)
    ;; error check for the $sQuery goes here
    Return _mciSendString("status " & $sAlias & " " & $sQuery, 255)
    EndFunc ;==>_Video_Status

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ==============================================================================================
    ; Name...........: _Video_Step
    ; Description....: Step a video forwards or backwards by a number of frames.
    ; Syntax.........: _Video_Step($sAlias, $iFrames)
    ; Parameters ....: $sAlias - Alias name returned by _Video_Open
    ; $iFrames - The number of frames to step, use negative numbers to step backwards.
    ; Return values .: Success - Returns 1 and @error 0
    ; Failure - Return 0 and @error 1~3
    ; @error 1 = Invalid Alias
    ; @error 2 = Invalid frames
    ; @error 3 = MCI Step error
    ; Author ........: smashly
    ; =========================================================================================================
    Func _Video_Step($sAlias, $iFrames)
    Local $iRet
    If $sAlias = "" Or StringRegExp($sAlias, "\W|_", 0) Then Return SetError(1, 0, 0)
    If StringRegExp(StringReplace($iFrames, "-", ""), '\D', 0) Then Return SetError(2, 0, 0)
    $iRet = _mciSendString("step " & $sAlias & " by " & $iFrames)
    If $iRet = 0 Then
    Return SetError(0, 0, 1)
    Else
    Return SetError(3, 0, 0)
    EndIf
    EndFunc ;==>_Video_Step

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ==============================================================================================
    ; Name...........: _Video_Stop
    ; Description....: Stop a Video playing. (seeks video to start)
    ; Syntax.........: _Video_Stop($sAlias)
    ; Parameters ....: $sAlias - Alias name returned by _Video_Open.
    ; Return values .: Success - Return 1 and @error 0
    ; Failure - Return 0 and @error 1~2
    ; @error 1 = Invalid Alias
    ; @error 2 = Failed to stop or seek
    ; Author ........: smashly
    ;==========================================================================================================
    Func _Video_Stop($sAlias)
    Local $iRet, $iRet2
    If $sAlias = "" Or StringRegExp($sAlias, "\W|_", 0) Then Return SetError(1, 0, 0)
    $iRet = _Video_Seek($sAlias, "start")
    $iRet2 = _mciSendString("stop " & $sAlias)
    If $iRet = 0 And $iRet2 = 0 Then
    Return SetError(0, 0, 1)
    Else
    Return SetError(2, 0, 0)
    EndIf
    EndFunc ;==>_Video_Stop

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ==============================================================================================
    ; Name...........: _Video_TimePos
    ; Description....: Get the time poition of a video in Milliseconds or Hours, Minutes, Seconds (HH:MM:SS)
    ; Syntax.........: _Video_TimePos($sAlias[, $iTime = 0])
    ; Parameters ....: $sAlias - Alias name returned by _Video_Open.
    ; $iTime - 0 Return time lenth in Hours, Minutes, Seconds (HH:MM:SS)
    ; - 1 Return time lenth in Milliseconds.
    ; Return values .: Success - Return time position in Milliseconds or Hours, Minutes, Seconds (HH:MM:SS)
    ; Failure - Return 0 and @error 1
    ; @error 1 = Invalid Alias
    ; Author ........: smashly
    ; =========================================================================================================
    Func _Video_TimePos($sAlias, $iTime = 0)
    Local $iMS
    If $sAlias = "" Or StringRegExp($sAlias, "\W|_", 0) Then Return SetError(1, 0, 0)
    _mciSendString("set " & $sAlias & " time format ms")
    $iMS = _mciSendString("status " & $sAlias & " position", 255)
    If Not $iTime Then Return _MSToHMS($iMS)
    If $iTime Then Return $iMS
    EndFunc ;==>_Video_TimePos

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ==============================================================================================
    ; Name...........: _Video_Volume
    ; Description....: Turn the video audio volume up or down.
    ; Syntax.........: _Video_AudioVolume($sAlias[, $iVolume = 100])
    ; Parameters ....: $sAlias - Alias name returned by _Video_Open.
    ; $iVolume - 0 = Min, 100 = Max
    ; Return values .: Success - Return 1 and @error 0
    ; Failure - Return 0 and @error 1~2
    ; @error 1 = Invalid Alias
    ; @error 2 = Invalid Volume
    ; @error 3 = MCI failed to set volume
    ; Author ........: smashly
    ; =========================================================================================================
    Func _Video_Volume($sAlias, $iVolume = 100)
    Local $iRet, $iVol
    If $sAlias = "" Or StringRegExp($sAlias, "\W|_", 0) Then Return SetError(1, 0, 0)
    If StringRegExp($iVolume, '\D', 0) Then Return SetError(2, 0, 0)
    If $iVolume >= 100 Then
    $iVol = 1000
    ElseIf $iVolume <= 0 Then
    $iVol = 0
    ElseIf $iVolume > 0 And $iVolume < 100 Then
    $iVol = $iVolume * 10
    EndIf
    $iRet = _mciSendString("setaudio " & $sAlias & " volume to " & $iVol)
    If $iRet = 0 Then
    Return SetError(0, 0, 1)
    Else
    Return SetError(3, 0, 0)
    EndIf
    EndFunc ;==>_Video_Volume

    [/autoit] [autoit][/autoit] [autoit]

    ;==========================================================================================================
    ; Internal use functions beyond this point
    ;==========================================================================================================

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ==============================================================================================
    ; Name...........: _MSToHMS
    ; Description....: Converts Milliseconds to Hours, Minutes, Seconds
    ; Syntax.........: _MSToHMS($iMS)
    ; Parameters ....: $iMS - Milliseconds to convert
    ; Return values .: Success - Returns Hours, Minutes, Seconds (HH:MM:SS)
    ; Author ........: smashly
    ; =========================================================================================================
    Func _MSToHMS($iMS)
    Local $iHours = 0, $iMins = 0, $iSecs = 0
    If Number($iMS) > 0 Then
    $iMS = Round($iMS / 1000)
    $iHours = Int($iMS / 3600)
    $iTicks = Mod($iMS, 3600)
    $iMins = Int($iTicks / 60)
    $iSecs = Round(Mod($iMS, 60))
    Return StringFormat("%02i:%02i:%02i", $iHours, $iMins, $iSecs)
    EndIf
    Return StringFormat("%02i:%02i:%02i", $iHours, $iMins, $iSecs)
    EndFunc ;==>_MSToHMS

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ==============================================================================================
    ; Name...........: _RandomStr
    ; Description....: Creates a random string
    ; Syntax.........: _RandomStr([$iLen = 10])
    ; Parameters ....: $iLen - Length of string to return
    ; Return values .: Success - Returns a string of random letters (a~z)
    ; Author ........: RazerM
    ; =========================================================================================================
    Func _RandomStr($iLen = 10)
    Local $sTmp = ''
    For $i = 1 To $iLen
    $sTmp &= Chr(Random(97, 122, 1))
    Next
    Return $sTmp
    EndFunc ;==>_RandomStr

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ==============================================================================================
    ; Name...........: _mciDeviceExists
    ; Description....: Check if a MCI Device type exists
    ; Syntax.........: _mciDeviceExists($sDevice)
    ; Parameters ....: $sDevice - Name of MCI Device type to check for
    ; Return values .: Success - Return 1 if MCI Device type exists and @error 0
    ; Failure - Return 0 if MCI Device type does not exist and @error 1~2
    ; @error 1 = No matching MCI Device type found.
    ; @error 2 = Failed to list any MCI Device types
    ; Author ........: smashly
    ; =========================================================================================================
    Func _mciDeviceExists($sDevice)
    Local $aDT = _mciListDevices()
    If @error Then Return SetError(2, 0, 0)
    For $idx = 1 To $aDT[0]
    If $sDevice = $aDT[$idx] Then Return SetError(0, 0, 1)
    Next
    Return SetError(1, 0, 0)
    EndFunc ;==>_mciDeviceExists

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ==============================================================================================
    ; Name...........: _mciListDevices
    ; Description....: List all found MCI Device types in an array
    ; Syntax.........: _mciListDevices()
    ; Parameters ....: None
    ; Return values .: Success - Return 1D array of found MCI Device types and @error 0
    ; array[0] Number of MCI Device types found
    ; array[n] MCI Device type name
    ; Failure - Return empty 1D array and @error 1
    ; Author ........: smashly
    ; =========================================================================================================
    Func _mciListDevices()
    Local $iMD, $sTmp
    $iMD = _mciSendString("sysinfo all quantity", 255)
    If StringIsInt($iMD) Then
    For $idx = 1 To $iMD
    $sTmp &= _mciSendString("sysinfo all name " & $idx, 255) & Chr(0)
    Next
    Return SetError(0, 0, StringSplit(StringTrimRight($sTmp, 1), Chr(0)))
    EndIf
    Return SetError(1, 0, StringSplit($sTmp, Chr(0)))
    EndFunc ;==>_mciListDevices

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ==============================================================================================
    ; Name...........: _mciSendString
    ; Description....:
    ; Syntax.........: _mciSendString($string[, $iLen = 0])
    ; Parameters ....: $string
    ; $iLen
    ; Return values .:
    ; Author ........: RazerM
    ; =========================================================================================================
    Func _mciSendString($string, $iLen = 0)
    Local $iRet
    $iRet = DllCall("winmm.dll", "int", "mciSendStringA", "str", $string, "str", "", "long", $iLen, "long", 0)
    If Not @error Then Return $iRet[2]
    EndFunc ;==>_mciSendString

    [/autoit]

    Original:
    http://www.autoitscript.com/forum/index.php?showtopic=79637

    lgE

  • Mediaplayer der mehrere Formate abspielen kann

    • eukalyptus
    • 7. September 2008 um 22:41

    Danke für diesen Ansatz, leider klappt das nicht!

    Hab zum testen eine Pascal-Dll geschrieben, welcher ich dann das Array übergebe;
    Autoit endet direkt beim DllCall mit:

    Code
    AutoIT3.exe ended.rc:-1073741819

    Edit: Blödsinn, meine TestDll funktioniert nicht, weil es ein Void_Pointer sein soll und kein Array of PChar!

    mit Vlc geht es leider auch nicht, da kommt "der Befehl "written" konnte auf dem Speicher nicht durchgeführt werden"!

    werd mal weiter probieren..

    lgE

  • Mediaplayer der mehrere Formate abspielen kann

    • eukalyptus
    • 7. September 2008 um 19:22

    Ich hänge immer noch an dem Problem, ein String-Array via DllCall zu übergeben...

    Im englischen Forum gibt es jedoch ein interessantes Video-Script auf MCI-Basis:
    http://www.autoitscript.com/forum/index.php?showtopic=79637

    lgE

  • GEht das?

    • eukalyptus
    • 6. September 2008 um 10:39

    Ich wundere mich, daß ich den Link auf die eigentliche Bezahlseite wie "Wann stirbst du" usw. nicht finden kann...
    Für mich sieht das wie eine Idiotenanlock Seite aus - ich kann nur nicht erkennen für was!?!

    E

  • Bitrate einer MP3-Datei auslesen

    • eukalyptus
    • 5. September 2008 um 09:16

    Bei einer VBR-codierten Mp3 haben alle Frames unterschiedliche Bitraten.
    Du müsstest alle Frame-Header auslesen und dann den Durchschnitt ausrechnen.
    oder nur ein paar und dann Minimum-Maximum Bitrate ermitteln.

    Die Bitrate ist in den ersten 4 Bits des 3 Bytes codiert

    es gibt auch commandline-tools (encspot.exe!?) die das für dich erledigen.

    lgE

    //EDIT: Du kannst auch die Bitrate aus der Dateiinfo auslesen mit der ExtProp.au3 UDF (oder so ähnlich)
    Das ist dann die Bitrate, die Windows ermittelt, vielleicht steht da auch Min/Max-Bitrate bei VBR´s!?

  • µit - September

    • eukalyptus
    • 2. September 2008 um 20:09

    logisch sind die beiden Funktionen noch drinnen, sonst würde ja der Benchmarktest nicht funktionieren...

    für den Wettbewerb schick ich eh meine anderen Versionen ins Rennen!
    Jetzt arbeite ich grad an der Version für die Scriptgröße...
    Und ich bin am verzweifeln! ;)

    lgE

  • µit - September

    • eukalyptus
    • 2. September 2008 um 19:39

    Hab meine Version jetzt erweitert:

    Kommt ohne _BigInt_Load und _BigInt_Print aus, d.h. die Rechenfunktionen können direkt verwendet werden
    Negative Zahlen (z.b. "-1355") werden berücksichtigt
    _BigInt_Sub und _BigInt_Div wurden hinzugefügt
    _BigInt_Div($a,$b,$Dec=0): $Dec = Anzahl der Dezimalstellen, wenn 0 dann normaler Rest - wird als extra Variable zurückgegeben

    Die Laufzeiten bei 50 Rechenoperationen mit zufälligen (auch negativen) Zahlen mit einer Länge von 10-90 Stellen:
    Add: 15.9071
    SUB: 17.6079
    MUL: 209.5421
    DIV: 1479.0203

    Scriptgröße: 7.665 Bytes

    Die Laufzeiten mit benchmark_speed.au3:
    Average: 0.078
    Minimum: 0.076
    Maximum: 0.081

    8)

    So, nun werd ich mal probieren, wie klein ich meine Version 4 machen kann...

    lgE

  • µit - September

    • eukalyptus
    • 1. September 2008 um 15:38

    Meine Werte (sind fast gleich wie Waluev´s):

    Add: 0.042
    Mul: 0.026

    Allerdings hab ich das größte Script und es ist mehr als 3 mal so groß wie das von Peethebee :(

    Auf geht´s, vielleicht schafft ja noch jemand die 0.05!

    Auf neue Rekorde wartend,
    Eukalyptus :D

  • µit - September

    • eukalyptus
    • 1. September 2008 um 02:14

    Ich kann jetzt (nach mehrstündigem scripten) auch updaten!

    Bin schon gespannt auf die Laufzeiten - ich sag nur: das Rennen geht weiter :thumbup:

    Die "alten" Versionen lass ich zum späteren Vergleich online.
    Zumindest der Algorithmus meiner Beta3 ist interessant - wenn auch nicht leicht verständlich...

    lgE

  • µit - September

    • eukalyptus
    • 31. August 2008 um 22:14

    OK, ich hab mein aktuelles Script auch hochgeladen...
    Habs mal mit Beta3 betitelt, da ich noch am experimentieren bin.

    Aber jetzt mal ehrlich Pee, wie um alles in der Welt schaffst du einen Multiplikationsalgorithmus, der fast so schnell wie die Addition ist?!? 8|

    lgE

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™