Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/05/2020 in Posts

  1. ... and a huge amount of work to do through long nights trying to make error checking as clean and thorough as possible
    2 points
  2. And for completeness, here is my quickly cobbled together extraction from another program of mine that uses either the DLL or EXE file of the CLI version of MediaInfo. Please note that I wasn't able to test the EXE version as I only had the DLL at hand. It also only returns duration, so you would need to use other parameters for more detail. I am fairly certain there is a list of parameters somewhere here at the forum, but a google search might be better. Local $audlog, $dur, $fldpth, $handle, $medfle, $mediainfo, $medinfdll, $medll, $runtime, $srcfle, $time, $usemed $medfle = @ScriptDir & "\Medlog.txt" $mediainfo = @ScriptDir & "\MediaInfo_CLI\MediaInfo.exe" $medinfdll = @ScriptDir & "\MediaInfo_CLI\MediaInfo.dll" $usemed = 1 If $usemed = 1 Then If FileExists($medinfdll) Then $medll = DllOpen($medinfdll) If Not @error Then $handle = DllCall($medll, "ptr", "MediaInfo_New") $handle = $handle[0] Else $usemed = "" EndIf ElseIf FileExists($mediainfo) Then $usemed = 2 Else $usemed = "" EndIf ElseIf $usemed = 2 Then If Not FileExists($mediainfo) Then $usemed = "" EndIf If $usemed <> "" Then $fldpth = "D:\Video\Downloads\" $srcfle = $fldpth & "Sir Terry Pratchett Shaking Hands With Death (2010) Assisted Suicide Euthanasia.webm.f136" ;$srcfle = $fldpth & "Sir Terry Pratchett Shaking Hands With Death (2010) Assisted Suicide Euthanasia.f251.webm" If FileExists($srcfle) Then $dur = "" If $usemed = 1 Then DllCall($medll, "dword", "MediaInfo_Open", "ptr", $handle, "wstr", $srcfle) $runtime = DllCall($medll, "wstr", "MediaInfo_Get", "ptr", $handle, _ "int", 0, "int", 0, "wstr", "Duration_String3", "int", 1, "int", 0) ; $dur = $runtime[0] $time = StringSplit($dur, ":") If $time[0] > 2 Then If $time[1] < 1 Then $dur = $time[2] & ":" & $time[3] EndIf $dur = StringSplit($dur, ".") $dur = $dur[1] Else $dur = "" EndIf ;$runtime = _ArrayToString($runtime) ;MsgBox(262208, "$runtime", $runtime, 0) DllCall($medll, "none", "MediaInfo_Close", "ptr", $handle) MsgBox(262208, "Duration", $dur, 0) ElseIf $usemed = 2 Then RunWait($mediainfo & ' "--Inform=Audio;Duration is: %Duration/String3%" --LogFile="' & $medfle & '" "' & $srcfle & '"', "", @SW_HIDE) Sleep(100) _FileReadToArray($medfle, $audlog) If @error = 0 Then ;_ArrayDisplay($audlog) $dur = StringReplace($audlog[1], "Duration is:", "") ;MsgBox(262208, "$dur", $dur, 0) $dur = StringStripWS($dur, 8) $dur = StringMid($dur, 4, 5) Else $dur = "" EndIf If $dur <> "" Then $time = StringSplit($dur, ":") If Not @error Then If $time[0] = 3 Then If $time[1] < 1 Then $dur = ($time[2] * 60) + $time[3] Else $dur = (($time[1] * 60) * 60) + ($time[2] * 60) + $time[3] EndIf ElseIf $time[0] = 2 Then If $time[1] < 1 Then $dur = $time[2] Else $dur = ($time[1] * 60) + $time[2] EndIf Else $dur = "" EndIf Else $dur = "" EndIf EndIf ShellExecute($medfle) MsgBox(262208, "Duration", $dur, 0) EndIf EndIf If $usemed = 1 Then DllClose($medll) EndIf EndIf Exit
    1 point
  3. I really appreciate your kindness. Thanks a lot.
    1 point
  4. I'll have to remember where an example of my MediaInfo code is, but for now, here is my ffmpeg version. As you can see I have two different source files, one being audio the other video and both are a webm variant. Both return duration for me. #include <File.au3> Local $duration, $file, $logfle, $pid, $read, $show, $sleep, $srcefle, $video, $vidinfo, $winstate ; $logfle = @ScriptDir & "\Logged.txt" $show = 4 ;$srcefle = "D:\Video\Downloads\Sir Terry Pratchett Shaking Hands With Death (2010) Assisted Suicide Euthanasia.f251.webm" $srcefle = "D:\Video\Downloads\Sir Terry Pratchett Shaking Hands With Death (2010) Assisted Suicide Euthanasia.webm.f136" $vidinfo = @ScriptDir & "\Vidinfo.txt" _FileCreate($vidinfo) Sleep(1000) If $show = 1 Then $winstate = @SW_HIDE Else $winstate = @SW_MINIMIZE EndIf $pid = RunWait(@ComSpec & ' /c ffmpeg.exe -i "' & $srcefle & '" 2>"' & $vidinfo & '"', "", $winstate) ProcessWaitClose($pid, 15) ;Sleep($sleep) $file = FileOpen($vidinfo, 0) $read = FileRead($file) FileClose($file) $duration = StringSplit($read, 'Duration:', 1) If $duration[0] > 1 Then $duration = $duration[2] $video = $duration $duration = StringSplit($duration, ',', 1) If $duration[0] > 1 Then $duration = StringStripWS($duration[1], 3) $video = StringSplit($video, 'yuv', 1) If $video[0] > 1 Then $video = $video[2] $video = StringSplit($video, '[', 1) $video = StringStripWS($video[1], 3) Else $video = "" EndIf Else $duration = "" $video = "" EndIf Else $duration = "" $video = "" EndIf If $duration = "" Then $video = "unknown." Else If $video = "" Then $video = $duration Else $video = $duration & " (" & $video & ")." EndIf EndIf _FileWriteLog($logfle, $srcefle & ". Duration = " & $video & @CRLF, 1) ShellExecute($vidinfo) ShellExecute($logfle) Exit I extracted this code from one of my programs and then quickly modified it to work for you. You need ffmpeg.exe to exist in the script folder or in the system PATH. You may also need ffprobe.exe as well, which should come in the same package. You of course need to provide your own source file(s).
    1 point
  5. @TheSaint Thank you for sharing your experience and saving my time trying to do something infeasible. Even the TV & Movie software built into Windows 10 play back these files without duration information and no progress slider.
    1 point
  6. Wouldn't we all. I tried to do that for many years, but eventually gave up because it was either impossible or too hard, and I saw it as silly to reinvent the wheel ... which in this case would be reading bytes of a file header and converting hex values I suspect. Of the two options mentioned, both of which are free and readily available, MediaInfo CLI version is a small footprint and easy enough to include with your program, and not too different to including a DLL or even an Include file. File Properties seem to change with each OS, and they only stick to basic stuff anyway, and both MKV and WEBM are specialist container files, so not likely to provide anything without installing something.
    1 point
  7. @TheSaint and @mikellThanks, I will give it a try.
    1 point
  8. The most simple, easy and complete way would be (by far) to use an external tool which accepts command line, such as ffmpeg or Mediainfo CLI
    1 point
  9. Thanks for the tip, I found my solution, FileSetPos and then loop the entire file.
    1 point
  10. @rootx You have to go through each byte and compare the values with known values. Remember that a byte is just nothing but an 8 digit binary number My apologies for the lack of an example, I am a bit busy at the moment. Hopefully someone will take out the time to show you
    1 point
  11. It's been a while since you revised and released Autoit3Wrapper. Time for a feedback. The result is very positive! I tested it with several windows at the same time, some loaded with the same script, some loaded with different scripts. Some scripts loaded in SciTE and some loaded in PSPad. All at the same time! The result is excellent! The shortcut Ctrl+Break works with the corresponding correct window! Then with the next one, etc. Thanks for your excellent work. Bernd.
    1 point
  12. I have had a look back in the SVN repo and that test has been there since the beginning of the SVN repo, but it serves no purpose anymore as the reason for that test is gone in that part of the code. So I have cleaned it up a little and made a new beta version available you can test with now. Both au3check and tidy logic is updated. Jos
    1 point
  13. I've wanted to post this for a while. It's a great script to help debug control data....perfect scenario, when you have a 'Button' grouping, and spy tools cannot focus on those controls within the button bounds (groups). I also use it to verify that a given ID is not present more than once...if not, that's how I identify the control in future scripts. Output can be filtered by: 1) Filter by IsVisible 2) Filter by matching class (ex Button, Label, Static) 3) Filter by containing text #include <Array.au3> #include <WinAPI.au3> ConsoleWrite("Make your window active!" & @CRLF) Sleep(5000) GetAllWindowsControls(WinGetHandle("[ACTIVE]")) Func GetAllWindowsControls($hCallersWindow, $bOnlyVisible=Default, $sStringIncludes=Default, $sClass=Default) If Not IsHWnd($hCallersWindow) Then ConsoleWrite("$hCallersWindow must be a handle...provided=[" & $hCallersWindow & "]" & @CRLF) Return False EndIf ; Get all list of controls If $bOnlyVisible = Default Then $bOnlyVisible = False If $sStringIncludes = Default Then $sStringIncludes = "" If $sClass = Default Then $sClass = "" $sClassList = WinGetClassList($hCallersWindow) ; Create array $aClassList = StringSplit($sClassList, @CRLF, 2) ; Sort array _ArraySort($aClassList) _ArrayDelete($aClassList, 0) ; Loop $iCurrentClass = "" $iCurrentCount = 1 $iTotalCounter = 1 If StringLen($sClass)>0 Then For $i = UBound($aClassList)-1 To 0 Step - 1 If $aClassList[$i]<>$sClass Then _ArrayDelete($aClassList,$i) EndIf Next EndIf For $i = 0 To UBound($aClassList) - 1 If $aClassList[$i] = $iCurrentClass Then $iCurrentCount += 1 Else $iCurrentClass = $aClassList[$i] $iCurrentCount = 1 EndIf $hControl = ControlGetHandle($hCallersWindow, "", "[CLASSNN:" & $iCurrentClass & $iCurrentCount & "]") $text = StringRegExpReplace(ControlGetText($hCallersWindow, "", $hControl), "[\n\r]", "{@CRLF}") $aPos = ControlGetPos($hCallersWindow, "", $hControl) $sControlID = _WinAPI_GetDlgCtrlID($hControl) $bIsVisible = ControlCommand($hCallersWindow, "", $hControl, "IsVisible") If $bOnlyVisible And Not $bIsVisible Then $iTotalCounter += 1 ContinueLoop EndIf If StringLen($sStringIncludes) > 0 Then If Not StringInStr($text, $sStringIncludes) Then $iTotalCounter += 1 ContinueLoop EndIf EndIf If IsArray($aPos) Then ConsoleWrite("Func=[GetAllWindowsControls]: ControlCounter=[" & StringFormat("%3s", $iTotalCounter) & "] ControlID=[" & StringFormat("%5s", $sControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[" & StringFormat("%4s", $aPos[0]) & "] YPos=[" & StringFormat("%4s", $aPos[1]) & "] Width=[" & StringFormat("%4s", $aPos[2]) & "] Height=[" & StringFormat("%4s", $aPos[3]) & "] IsVisible=[" & $bIsVisible & "] Text=[" & $text & "]." & @CRLF) Else ConsoleWrite("Func=[GetAllWindowsControls]: ControlCounter=[" & StringFormat("%3s", $iTotalCounter) & "] ControlID=[" & StringFormat("%5s", $sControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[winclosed] YPos=[winclosed] Width=[winclosed] Height=[winclosed] Text=[" & $text & "]." & @CRLF) EndIf If Not WinExists($hCallersWindow) Then ExitLoop $iTotalCounter += 1 Next EndFunc ;==>GetAllWindowsControls
    1 point
  14. AutoItSetOption("MouseCoordMode",2) for client AutoItSetOption("MouseCoordMode",0) for window But a Control based click will be more effective, and doesn't need an X/Y coord at all. ControlClick.
    1 point
  15. I think the best approach is to avoid memory leaks. Means: Release storage when it is no longer used. Set unused arrays to "" to release the memory, set unused objects to 0 to drop a connection, application or whatever.
    1 point
  16. Very Nice But I notice that [msctls_statusbar321] get text only from first element. Cheers. mLipok
    1 point
  17. select count(*) from sqlite_master where type='table' and name like 'mytable' will return 0 or 1 depending on table existence. Now the kludge above is probably not what you actually need. Try this instead: $sExec = "CREATE TABLE if not exists TableNameHere (ID_Here INTEGER PRIMARY KEY,a,b,c,d,e);"Pure SQL does it. See SQLite docs.
    1 point
  18. "To create a new control on an existing tabitem use GUISwitch($hWin,$tabitem) to select it and just create your new control. Don't forget to close your tabitem creation with GUICtrlCreateTabItem("")." Add a GUICtrlCreateTabItem("") after the GUICtrlCreateInput().
    1 point
×
×
  • Create New...