duketrapp Posted May 8, 2006 Share Posted May 8, 2006 (edited) i try find a solution get an avis length... ...i found this in vb script... can i convert the "get length" part in autoit comands?.. VB Code expandcollapse popupPrivate Declare Function AVIFileOpen Lib "avifil32" _ Alias "AVIFileOpenA" ( _ ppfile As Long, _ ByVal szFile As String, _ ByVal mode As Long, _ pclsidHandler As Any) As Long Private Declare Function AVIFileRelease Lib "avifil32" ( _ ByVal pfile As Long) As Long Private Declare Function AVIFileInfo Lib "avifil32" _ Alias "AVIFileInfoA" ( _ ByVal pfile As Long, _ pfi As AVIFileInfo, _ ByVal lSize As Long) As Long Private Declare Sub AVIFileInit Lib "avifil32" () Private Declare Sub AVIFileExit Lib "avifil32" () ' AVI Info-Struktur Private Type AVIFileInfo dwMaxBytesPerSec As Long dwFlags As Long dwCaps As Long dwStreams As Long dwSuggestedBufferSize As Long dwWidth As Long dwHeight As Long dwScale As Long dwRate As Long dwLength As Long dwEditCount As Long szFileType As String * 64 End Type ' Länge (Spieldauer) ermitteln ' (Rückgabewert erfolgt in Millisekunden) Public Function AVI_GetLength(ByVal sFile As String) As Long Dim hFile As Long Dim AviInfo As AVIFileInfo Dim nLength As Long ' Fehlerbehandlung aktivieren On Error Resume Next ' Initialisieren AVIFileInit ' AVI öffnen (Handle erstellen) If AVIFileOpen(hFile, sFile, &H20, ByVal 0&) = 0 Then ' Infos lesen If AVIFileInfo(hFile, AviInfo, Len(AviInfo)) = 0 Then <-------I THNK ITS THIS!!! nLength = AviInfo.dwLength End If AVIFileRelease hFile End If ' Beenden AVIFileExit On Error Goto 0 ' Rückgabewert AVI_GetLength = nLength End Function Edited May 8, 2006 by duketrapp AVIfileLength,WMPSendKeycontrolled,... Link to comment Share on other sites More sharing options...
seandisanti Posted May 8, 2006 Share Posted May 8, 2006 i try find a solution get an avis length... ...i found this in vb script... can i convert the "get length" part in autoit comands?.. VB Code expandcollapse popupPrivate Declare Function AVIFileOpen Lib "avifil32" _ Alias "AVIFileOpenA" ( _ ppfile As Long, _ ByVal szFile As String, _ ByVal mode As Long, _ pclsidHandler As Any) As Long Private Declare Function AVIFileRelease Lib "avifil32" ( _ ByVal pfile As Long) As Long Private Declare Function AVIFileInfo Lib "avifil32" _ Alias "AVIFileInfoA" ( _ ByVal pfile As Long, _ pfi As AVIFileInfo, _ ByVal lSize As Long) As Long Private Declare Sub AVIFileInit Lib "avifil32" () Private Declare Sub AVIFileExit Lib "avifil32" () ' AVI Info-Struktur Private Type AVIFileInfo dwMaxBytesPerSec As Long dwFlags As Long dwCaps As Long dwStreams As Long dwSuggestedBufferSize As Long dwWidth As Long dwHeight As Long dwScale As Long dwRate As Long dwLength As Long dwEditCount As Long szFileType As String * 64 End Type ' Länge (Spieldauer) ermitteln ' (Rückgabewert erfolgt in Millisekunden) Public Function AVI_GetLength(ByVal sFile As String) As Long Dim hFile As Long Dim AviInfo As AVIFileInfo Dim nLength As Long ' Fehlerbehandlung aktivieren On Error Resume Next ' Initialisieren AVIFileInit ' AVI öffnen (Handle erstellen) If AVIFileOpen(hFile, sFile, &H20, ByVal 0&) = 0 Then ' Infos lesen If AVIFileInfo(hFile, AviInfo, Len(AviInfo)) = 0 Then <-------I THNK ITS THIS!!! nLength = AviInfo.dwLength End If AVIFileRelease hFile End If ' Beenden AVIFileExit On Error Goto 0 ' Rückgabewert AVI_GetLength = nLength End Functionlook up dllcall() and dllstructcreate() there are examples on the forum also. you should make sure you have that dll also. (can't call a function in a file you don't have right?) Link to comment Share on other sites More sharing options...
duketrapp Posted May 8, 2006 Author Share Posted May 8, 2006 im not firm in dll handling.. just thought it would be possible to get this .avi info with a simple autoit phrase... AVIfileLength,WMPSendKeycontrolled,... Link to comment Share on other sites More sharing options...
seandisanti Posted May 8, 2006 Share Posted May 8, 2006 im not firm in dll handling.. just thought it would be possible to get this .avi info with a simple autoit phrase...'simple' is subjective. the code you posted is calling a function in a dll (or so it appears to me) you CAN call the same dll through autoit, with the same values etc, and should get the same result. beta is required, and dllcall() / dllstructcreate() in the help file will help you. Link to comment Share on other sites More sharing options...
duketrapp Posted May 8, 2006 Author Share Posted May 8, 2006 beta is required, and dllcall() / dllstructcreate() in the help file will help you...okido.... just needed a confirmation that its worth to have an eye on this AVIfileLength,WMPSendKeycontrolled,... Link to comment Share on other sites More sharing options...
Simucal Posted May 8, 2006 Share Posted May 8, 2006 (edited) One way to do it would be to use Windows Media Player as an object and get the attributes for length.Those attributes for video files are outlines here:http://msdn.microsoft.com/library/default....mattributes.aspDuration AttributeThe Duration attribute is the playing duration of the item, in seconds.RemarksThis attribute is stored in both Media Library and the digital media file.If you still need help when I get off work I'll write something up for you real fast. Edited May 8, 2006 by Simucal AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc) Link to comment Share on other sites More sharing options...
duketrapp Posted May 8, 2006 Author Share Posted May 8, 2006 (edited) If you still need help ... ... i realy dont have a clue on objects... :"> ..but... i looked a bit and try this: $oMedia = ObjGet("","MediaPlayer.MediaPlayer.1") $oMediadur = $oMedia.currentMedia.duration ..and like i expected its not workin ... but i m right that the comand "player.currentMedia.duration" is what i need?... ..maybe i need this "read access to Media Library" or im just to noob to get the right spelling in writing the object code.. ..like i say... im new to this... but i tried ... script give me "Variable must be of type Object" error... ..btw... the videofile i need the length from is open when i try to use this object things... so i thnk i read that u dont need "ObjCreate" when the file is opened...but.. maybe im wrong Edited May 8, 2006 by duketrapp AVIfileLength,WMPSendKeycontrolled,... Link to comment Share on other sites More sharing options...
Simucal Posted May 8, 2006 Share Posted May 8, 2006 (edited) As it turns out, there is a better way to do it.. it took a little bit of digging on my part. The first method I mentioned would work, but you would have to first add the video to the media player collection (and I think you must do that manually). So, after a little searching I came across some extended attributes. I think I might make a series of UDF's out of these. In any case, here you go: $filepath = FileOpenDialog("Duration Test",@ScriptDir,"Videos (*.avi;*.mpg;*.mpeg;*.rm)") ConsoleWrite($filepath&@CRLF) $vid = StringTrimLeft($filepath,StringInStr($filepath,"\",0,-1)) $dir = StringTrimRight($filepath,(StringLen($filepath)-StringInStr($filepath,"\",0,-1))) $ShellApp = ObjCreate("shell.application") $oDir = $ShellApp.NameSpace($dir) $oVid = $oDir.Parsename($vid) $duration = $oDir.GetDetailsOf($oVid, 0x15) msgbox(0,"Duration","Duration of Video: "&$duration) Modify to do what you want with it. Edited May 8, 2006 by Simucal AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc) Link to comment Share on other sites More sharing options...
Valuater Posted May 9, 2006 Share Posted May 9, 2006 It doesn't work for me... no errors, just a message box with no .avi info Win Xp SP2 8) Link to comment Share on other sites More sharing options...
Simucal Posted May 9, 2006 Share Posted May 9, 2006 (edited) $filepath = FileOpenDialog("Duration Test",@ScriptDir,"Videos (*.avi;*.mpg;*.mpeg;*.rm)") ConsoleWrite($filepath&@CRLF) $vid = StringTrimLeft($filepath,StringInStr($filepath,"\",0,-1)) $dir = StringTrimRight($filepath,(StringLen($filepath)-StringInStr($filepath,"\",0,-1))) $ShellApp = ObjCreate("shell.application") $oDir = $ShellApp.NameSpace($dir) $oVid = $oDir.Parsename($vid) $duration = $oDir.GetDetailsOf($oVid, 21) msgbox(0,"Duration","Duration of Video: "&$duration)Try that val.Edit: Just tried it on a mpg and it didnt work. It will only work if the value is present when you right click properties on a video file, and select Summary (in advanced mode). If you dont see a duration there for your video then it wont show up. It shows up for most of my videos fine though. Edited May 9, 2006 by Simucal AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc) Link to comment Share on other sites More sharing options...
duketrapp Posted May 9, 2006 Author Share Posted May 9, 2006 Simucal ur da man... small,simple,easy to use.. thats what i was searchin for.. ..works perfect... thnks a lot for ur search.. ..all other thnks too for input.. ..salute... AVIfileLength,WMPSendKeycontrolled,... Link to comment Share on other sites More sharing options...
jokke Posted March 2, 2008 Share Posted March 2, 2008 Sorry for bringing upp an old topic but id love to have this working. Anyone have any idea why Simucal example does not work anymore? UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt. Link to comment Share on other sites More sharing options...
LIMITER Posted March 2, 2008 Share Posted March 2, 2008 You can also use the <ExtProp.au3> (you can dld it HERE) ...Hope it helped you ... Link to comment Share on other sites More sharing options...
jokke Posted March 2, 2008 Share Posted March 2, 2008 (edited) Thanks My secound quest is then to find a tool where i can get attributes from mkv,mpg,divx files. Does anyone know of any tool where i can retrive extensive attributes from mkv,avi,mpg,divx files ? Basicly only need to know a few parameters but i need them as correct as possible, Video Codec, Audio Codec, Audio Bitrate, Video Bitrate , Width, Height, Duration. Edited March 2, 2008 by jokke UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt. Link to comment Share on other sites More sharing options...
LIMITER Posted March 2, 2008 Share Posted March 2, 2008 You could try this ... #include "ExtProp.au3" $file = "c:\video.wmv";change this with the location of the file $w = _GetExtProperty($file,27) $h = _GetExtProperty($file,28) $d = _GetExtProperty($file,21) MsgBox(32,"File Info","File : " & $file & @CRLF & @CRLF & "Width : " & $w & @CRLF & "Height : " & $h & @CRLF & "Duration : " & $d) Link to comment Share on other sites More sharing options...
jokke Posted March 2, 2008 Share Posted March 2, 2008 (edited) _GetExtProperty works great on avi,wmv,mp4 files but it wont show any usable data from mkv,mpeg,divx files though. Trying to figure out if GSpot has commandline parameters. SOLUTION: Dirty but it works. Download MPlayer (not windows media player) and then use these parameters: $foo = Run(@ComSpec & ' /c mplayer.exe -vo null -ao null -frames 0 -identify '&FileGetShortName($file), @ScriptDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) While 1 $line = StdoutRead($foo) If @error Then ExitLoop MsgBox(0,"",$line) WEnd Edited March 2, 2008 by jokke UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt. Link to comment Share on other sites More sharing options...
GEOSoft Posted March 2, 2008 Share Posted March 2, 2008 This will work for some info but I don't really like it because it's looping through all the files in a folder to find the one you want. Func _FileGetDetails($File);; $File is the Full path and file name if the file to check. $objShell = ObjCreate("Shell.Application") $Path = StringLeft($File, StringInStr($File, "\", 0, -1) -1) $fName = StringMid($File, StringInStr($File, "\", 0, -1) +1) $objFolder = $objShell.Namespace($Path) For $Filename In $objFolder.Items If $objFolder.GetDetailsOf($Filename, 0) = $fName Then MsgBox(0, "TEST", "Duration : " & $objFolder.GetDetailsOf($Filename, 21)) Next EndFunc ;<==> _FileGetDetails($File) Here are the possibilities for the value in $objFolder.GetDetailsOf($Filename, value) 0 Name 1 Size 2 Type 3 Date Modified 4 Date Created 5 Date Accessed 6 Attributes 7 Status 8 Owner 9 Author 10 Title 11 Subject 12 Category 13 Pages 14 Comments 15 Copyright 16 Artist 17 Album Title 18 Year 19 Track Number 20 Genre 21 Duration 22 Bit Rate 23 Protected 24 Camera Model 25 Date Picture Taken 26 Dimensions 27, 28, 29 Not used 30 Company 31Description 32 File Version 33 Product Name 34 Product Version George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
GEOSoft Posted March 2, 2008 Share Posted March 2, 2008 (edited) Here is a slightly improved version of what I posted earlier Where $File is the Full path and file name if the file to check. $Prop is the File property that you want from the list I gave Func _FileGetDetails($File, $Prop = 0) Dim $arrHeaders[35] $objShell = ObjCreate("Shell.Application") $Path = StringLeft($File, StringInStr($File, "\", 0, -1) -1) $fName = StringMid($File, StringInStr($File, "\", 0, -1) +1) $objFolder = $objShell.Namespace($Path) For $i = 0 to 34 $arrHeaders[$i] = $objFolder.GetDetailsOf($objFolder.Items, $i) Next For $Filename In $objFolder.Items If $objFolder.GetDetailsOf($Filename, 0) = $fName Then MsgBox(0, $objFolder.GetDetailsOf($Filename, 0), $arrHeaders[$Prop] & " : " & $objFolder.GetDetailsOf($Filename, $Prop)) ExitLoop EndIf Next EndFunc;<==> _FileGetDetails($File) Edited March 2, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
eyalsemo Posted March 5, 2008 Share Posted March 5, 2008 Hi GEOSoft and tnx, I don't see how your code let me change the file attributes Am I missing something Eyal Link to comment Share on other sites More sharing options...
GEOSoft Posted March 6, 2008 Share Posted March 6, 2008 Hi GEOSoft and tnx,I don't see how your code let me change the file attributesAm I missing somethingEyalIt wasn't written to change anything only to get the information. Changing is a different story. And this is for file properties not attributes. For attributes all you need is FileSetAttrib() in the help file. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now