Metadaten

  • Hallo,
    ich habe hier (unter #3) ein Script gefunden, mit dem man (angeblich) Metadaten einer Datei auslesen kann (z.B. Titel oder Länge einer mp3-Datei).
    Wenn ich mal davon absehe, dass die Zeile 64 ziemlich sinnlos erscheint (es wird nach nichts gesucht, das wird von der Pfadlänge abgezogen und um diese Zahl wird der Pfad von rechts gekürzt, d.h. $sDir ist immer nichts), konnte man das ja noch anpassen indem anstelle von $sDir einen festen Pfad vorgibt, habe ich trotzdem kein Ergebnis.
    Nun habe ich entweder hier oder im autoitscript-fprum gelesen, dass das vom Betriebssystem abhängen könnte.
    Meins ist Windows 8.1 64bit.
    Kann mir das jemand bestätigen oder sagen wo der Fehler liegt?
    Merci vielmals

    Einmal editiert, zuletzt von schelle (1. Februar 2014 um 16:55)

  • Es könnte auch am Dateityp liegen, nicht bei jedem werden dir Informationen ausgegeben.

    Die verwendeten Funktionen sollten aber auch bei Windows 8 noch verfügbar sein, dass würde sonst bei MSDN stehen. Vielleicht liegt der Fehler ja im Skript, du könntest ja mal meine Version testen:

    Spoiler anzeigen
    [autoit]

    Func FileGetInfo($sFile, $iColumn=-1)
    If (Not FileExists($sFile)) Then Return SetError(-1, 0, "")
    Local Static $aInfoNames[284] = ["Name", "Size", "Item type", "Date modified", "Date created", "Date accessed", "Attributes", "Offline status", "Offline availability", "Perceived type", "Owner", "Kind", "Date taken", "Contributing artists", "Album", "Year", "Genre", "Conductors", "Tags", "Rating", "Authors", "Title", "Subject", "Categories", "Comments", "Copyright", "#", "Length", "Bit rate", "Protected", "Camera model", "Dimensions", "Camera maker", "Company", "File description", "Program name", "Duration", "Is online", "Is recurring", "Location", "Optional attendee addresses", "Optional attendees", "Organizer address", "Organizer name", "Reminder time", "Required attendee addresses", "Required attendees", "Resources", "Meeting status", "Free/busy status", "Total size", "Account name", "Task status", "Computer", "Anniversary", "Assistant's name", "Assistant's phone", "Birthday", "Business address", "Business city", "Business country/region", "Business P.O. box", "Business postal code", "Business state or province", "Business street", "Business fax", "Business home page", "Business phone", "Callback number", "Car phone", "Children", "Company main phone", "Department", "E-mail address", "E-mail2", "E-mail3", "E-mail list", "E-mail display name", "File as", "First name", "Full name", "Gender", "Given name", "Hobbies", "Home address", "Home city", "Home country/region", "Home P.O. box", "Home postal code", "Home state or province", "Home street", "Home fax", "Home phone", "IM addresses", "Initials", "Job title", "Label", "Last name", "Mailing address", "Middle name", "Cell phone", "Nickname", "Office location", "Other address", "Other city", "Other country/region", "Other P.O. box", "Other postal code", "Other state or province", "Other street", "Pager", "Personal title", "City", "Country/region", "P.O. box", "Postal code", "State or province", "Street", "Primary e-mail", "Primary phone", "Profession", "Spouse/Partner", "Suffix", "TTY/TTD phone", "Telex", "Webpage", "Content status", "Content type", "Date acquired", "Date archived", "Date completed", "Device category", "Connected", "Discovery method", "Friendly name", "Local computer", _
    "Manufacturer", "Model", "Paired", "Classification", "Status", "Client ID", "Contributors", "Content created", "Last printed", "Date last saved", "Division", "Document ID", "Pages", "Slides", "Total editing time", "Word count", "Due date", "End date", "File count", "Filename", "File version", "Flag color", "Flag status", "Space free", "Bit depth", "Horizontal resolution", "Width", "Vertical resolution", "Height", "Importance", "Is attachment", "Is deleted", "Encryption status", "Has flag", "Is completed", "Incomplete", "Read status", "Creators", "Date", "Folder name", "Folder path", "Folder", "Participants", "Path", "By location", "Type", "Contact names", "Entry type", "Language", "Date visited", "Description", "Link status", "Link target", "URL", "Media created", "Date released", "Encoded by", "Producers", "Publisher", "Subtitle", "User web URL", "Writers", "Attachments", "Bcc addresses", "Bcc", "Cc addresses", "Cc", "Conversation ID", "Date received", "Date sent", "From addresses", "From", "Has attachments", "Sender address", "Sender name", "Store", "To addresses", "To do title", "To", "Mileage", "Album artist", "Album ID", "Beats-per-minute", "Composers", "Initial key", "Part of a compilation", "Mood", "Part of set", "Period", "Color", "Parental rating", "Parental rating reason", "Space used", "EXIF version", "Event", "Exposure bias", "Exposure program", "Exposure time", "F-stop", "Flash mode", "Focal length", "35mm focal length", "ISO speed", "Lens maker", "Lens model", "Light source", "Max aperture", "Metering mode", "Orientation", "People", "Program mode", "Saturation", "Subject distance", "White balance", "Priority", "Project", "Channel number", "Episode name", "Closed captioning", "Rerun", "SAP", "Broadcast date", "Program description", "Recording time", "Station call sign", "Station name", "Summary", "Snippets", "Auto summary", "Search ranking", "Sensitivity", "Product name", "Product version", "Support link", "Source", "Start date", "Billing information", "Complete", "Task owner", "Total file size", "Legal trademarks", "Video compression", "Directors", "Data rate", "Frame height", "Frame rate", "Frame width", "Total bitrate"]
    Local $sDir, $oShell, $oDir, $oFile, $i, $sInfo = "", $sTemp
    $sFolder = StringRegExpReplace($sFile, "^(.+?[\\/])[^\\/]+$", "\1")
    If ($sFolder = $sFile) Then Return SetError(1, 0, "")
    $oShell = ObjCreate("Shell.Application")
    If @error Then Return SetError(2, 0, "")
    $oFolder = $oShell.NameSpace($sFolder)
    $oFile = $oFolder.ParseName($sFile)
    If ($iColumn > -1) And ($iColumn < 284) Then
    $sTemp = $oFolder.GetDetailsOf($oFile, $iColumn)
    If (Stringlen($sTemp) = 0) Then Return SetError(3, 0, "")
    Return $aInfoNames[$iColumn] & ": " & $sTemp
    EndIf
    For $i = 0 To 283
    $sTemp = $oFolder.GetDetailsOf($oFile, $i)
    If (Stringlen($sTemp) > 0) Then
    $sInfo &= $aInfoNames[$i] & ": " & $sTemp & @CRLF
    EndIf
    Next
    Return StringTrimRight($sInfo, 2)
    EndFunc

    [/autoit]

    AutoIt Version (Prod): 3.3.14.2

    AutoIt Version (Beta): 3.3.9.5

    ausgewählte Skripte: Chatbot, komplexe Zahlen (UDF)

    Einmal editiert, zuletzt von James (20. Januar 2014 um 20:42)

  • Hallo,
    sorry, kann mich erst jetzt melden.
    Irgendwie stelle ich mich zu dämlich an. Wenn ich deine Funktion so aufrufe

    [autoit]

    $Ergebnis = FileGetInfo("D:\topbankingstart.exe", 1)
    MsgBox(0, "", $Ergebnis)

    [/autoit]


    dann kriege ich als Ergebnis Size:Größe. Bei -1 dann eben eine riesengroße Messagebox.
    Das ist etwa so ähnlich wie bei dem anderen Skript, wenn ich die angesprochene Zeile mal entferne. Dann kriege ich eine Array mit den ganzen Bezeichnungen aber ohne Ergebnis.

  • Und keine dieser Zeilen hat Inhalt? Ok, bei einem Fehler wird anscheinend der Name der Spalte zurückgegeben, dadurch konnte ich die auch im Skript eintragen. (Bei einem englischen Windows sind die natürlich Englisch.) Dieser Fehler kam bei mir z.B. bei AutoIt-Skripten. Mit welchen Dateitypen hast du es denn versucht?
    Ich habe leider momentan keinen Zugriff auf einen PC mit Windows 8, kann es aber im Laufe der Woche selbst auch mal testen. Sollte aber eigentlich in MSDN angegeben sein, wenn das entfernt wurde. Es kommt ja aber auch kein Fehler, oder?

    Ich habe die Funktion im letzten Post nochmal überarbeitet, jetzt werden nur noch ausgefüllte Spalten angezeigt.

    Beispielausgabe einer MP3-Datei
  • Hallo,
    danke, aber auch hier keine Änderung, egal ob mp3 oder exe und die Dateigröße müßte ja nun immer da sein.
    Ich habe mittlerweile auch kein anderes Windows mehr zur Verfügung um das gegen zu testen.

  • Ok, das ist wirklich eigenartig. Ich werde es wie schon gesagt auch noch mal mit Windows 8 testen, erwarte da aber kein anderes Ergebnis.

    Vielleicht kennt ja jemand eine andere Möglichkeit. Brauchst du das nur für MP3-Dateien oder soll das mit allen Dateitypen funktionieren?

  • Hallo,
    es sollte schon für alle Dateitypen funktionieren. Deshalb habe ich mich ja vor Begeisterung fast nass gemacht, wie ich gesehen habe, was dein Script alles (theoretisch ;) ) liefert.
    Vielleicht ist ja wirklich noch jemand da, der sich opfert und bestätigt das das unter Windows 8.1 anderes ist oder mir sagt was ich falsch gemacht habe.

  • Salve,
    also es lag (war ja fast klar) nicht an Windows 8.
    Ich habe mich mal ein bißchen mit diesem Objectgedöns beschäftigt und war daher der Meinung, dass das Script aus Post 2 nicht funktionieren kann.
    In Zeile 10 wird $oFolder zugewiesen (z.B. D:\)
    In Zeile 11 wird $oFile zugewiesen (z.B. D:\beispiel.mp3).
    Allerdings nochmal mit dem kompletten Pfad, so das $oFile zu D:\D:\beispiel.mp3 wird.
    Jetzt habe ich das mal getrennt und viola, es klappt.

    Spoiler anzeigen
    [autoit]


    $path = FileOpenDialog("Select a file to read attributes",@ScriptDir,"All (*.*)")

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

    $Ergebnis = FileGetInfo($path, -1)
    MsgBox(0, "", $Ergebnis)

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

    Func FileGetInfo($sFile, $iColumn=-1)
    If (Not FileExists($sFile)) Then
    Return SetError(-1, 0, "")
    EndIf

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

    Local Static $aInfoNames[284] = ["Name", "Größe", "Item type", "Date modified", "Date created", "Date accessed", "Attributes", "Offline status", "Offline availability", "Perceived type", "Owner", "Kind", "Date taken", "Contributing artists", "Album", "Year", "Genre", "Conductors", "Tags", "Rating", "Authors", "Title", "Subject", "Categories", "Comments", "Copyright", "#", "Length", "Bit rate", "Protected", "Camera model", "Dimensions", "Camera maker", "Company", "File description", "Program name", "Duration", "Is online", "Is recurring", "Location", "Optional attendee addresses", "Optional attendees", "Organizer address", "Organizer name", "Reminder time", "Required attendee addresses", "Required attendees", "Resources", "Meeting status", "Free/busy status", "Total size", "Account name", "Task status", "Computer", "Anniversary", "Assistant's name", "Assistant's phone", "Birthday", "Business address", "Business city", "Business country/region", "Business P.O. box", "Business postal code", "Business state or province", "Business street", "Business fax", "Business home page", "Business phone", "Callback number", "Car phone", "Children", "Company main phone", "Department", "E-mail address", "E-mail2", "E-mail3", "E-mail list", "E-mail display name", "File as", "First name", "Full name", "Gender", "Given name", "Hobbies", "Home address", "Home city", "Home country/region", "Home P.O. box", "Home postal code", "Home state or province", "Home street", "Home fax", "Home phone", "IM addresses", "Initials", "Job title", "Label", "Last name", "Mailing address", "Middle name", "Cell phone", "Nickname", "Office location", "Other address", "Other city", "Other country/region", "Other P.O. box", "Other postal code", "Other state or province", "Other street", "Pager", "Personal title", "City", "Country/region", "P.O. box", "Postal code", "State or province", "Street", "Primary e-mail", "Primary phone", "Profession", "Spouse/Partner", "Suffix", "TTY/TTD phone", "Telex", "Webpage", "Content status", "Content type", "Date acquired", "Date archived", "Date completed", "Device category", "Connected", "Discovery method", "Friendly name", "Local computer", _
    "Manufacturer", "Model", "Paired", "Classification", "Status", "Client ID", "Contributors", "Content created", "Last printed", "Date last saved", "Division", "Document ID", "Pages", "Slides", "Total editing time", "Word count", "Due date", "End date", "File count", "Filename", "File version", "Flag color", "Flag status", "Space free", "Bit depth", "Horizontal resolution", "Width", "Vertical resolution", "Height", "Importance", "Is attachment", "Is deleted", "Encryption status", "Has flag", "Is completed", "Incomplete", "Read status", "Creators", "Date", "Folder name", "Folder path", "Folder", "Participants", "Path", "By location", "Type", "Contact names", "Entry type", "Language", "Date visited", "Description", "Link status", "Link target", "URL", "Media created", "Date released", "Encoded by", "Producers", "Publisher", "Subtitle", "User web URL", "Writers", "Attachments", "Bcc addresses", "Bcc", "Cc addresses", "Cc", "Conversation ID", "Date received", "Date sent", "From addresses", "From", "Has attachments", "Sender address", "Sender name", "Store", "To addresses", "To do title", "To", "Mileage", "Album artist", "Album ID", "Beats-per-minute", "Composers", "Initial key", "Part of a compilation", "Mood", "Part of set", "Period", "Color", "Parental rating", "Parental rating reason", "Space used", "EXIF version", "Event", "Exposure bias", "Exposure program", "Exposure time", "F-stop", "Flash mode", "Focal length", "35mm focal length", "ISO speed", "Lens maker", "Lens model", "Light source", "Max aperture", "Metering mode", "Orientation", "People", "Program mode", "Saturation", "Subject distance", "White balance", "Priority", "Project", "Channel number", "Episode name", "Closed captioning", "Rerun", "SAP", "Broadcast date", "Program description", "Recording time", "Station call sign", "Station name", "Summary", "Snippets", "Auto summary", "Search ranking", "Sensitivity", "Product name", "Product version", "Support link", "Source", "Start date", "Billing information", "Complete", "Task owner", "Total file size", "Legal trademarks", "Video compression", "Directors", "Data rate", "Frame height", "Frame rate", "Frame width", "Total bitrate"]
    Local $sDir, $oShell, $oDir, $oFile, $i, $sInfo = "", $sTemp
    $sFolder = StringRegExpReplace($sFile, "^(.+?[\\/])[^\\/]+$", "\1")

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

    If ($sFolder = $sFile) Then
    Return SetError(1, 0, "")
    EndIf
    $oShell = ObjCreate("Shell.Application")

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

    If @error Then
    Return SetError(2, 0, "")
    EndIf

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

    $oFolder = $oShell.NameSpace($sFolder)
    $oFile = $oFolder.ParseName(StringTrimLeft ($sFile, StringInStr($sFile, "", 0, -1)))

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

    If ($iColumn > -1) And ($iColumn < 284) Then
    $sTemp = $oFolder.GetDetailsOf($oFile, $iColumn)

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

    If (StringLen($sTemp) = 0) Then
    Return SetError(3, 0, "")
    EndIf

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

    Return $aInfoNames[$iColumn] & ": " & $sTemp
    EndIf

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

    For $i = 0 To 283
    $sTemp = $oFolder.GetDetailsOf($oFile, $i)

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

    If (Stringlen($sTemp) > 0) Then
    $sInfo &= $aInfoNames[$i] & ": " & $sTemp & @CRLF
    EndIf
    Next

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

    Return StringTrimRight($sInfo, 2)
    EndFunc

    [/autoit]


    Danke an James für die Hilfe

    P.S: Wie kann man denn die Einrückungen im Qulltext aus dem Editor hierher übertragen?