Extended file properties: datetaken

Hello,

I am trying to retrieve the datetaken property via diropus using vbscript.

I want to retrieve it for a specific dir, and not for a dir which is already open in diropus.

But when i try to do this using the code below, i always get the error "Invalid procedure call or argument (0x800a0005)"

option explicit
Function OnInit(initData)
	initData.name = "datetaken_via_diropus"
	initData.desc = ""
	initData.copyright = ""
	initData.version = "1.0"
	initData.default_enable = false

	Dim cmd

	Set cmd = initData.AddCommand
	cmd.name = "datetaken_via_diropus"
	cmd.method = "Ondatetaken_via_diropus"
	cmd.desc = ""
	cmd.label = "datetaken_via_diropus"
	cmd.template = ""
End Function

' Implement the datetaken_via_diropus command
Function Ondatetaken_via_diropus(scriptCmdData)
   Dim objShell, objFolder, outFile, objFile, objFSOLog, strFileName

   outFile="c:\temp\test.txt"
   Set objFSOLog=CreateObject("Scripting.FileSystemObject")
   Set objFile = objFSOLog.CreateTextFile(outFile,True)

   Set objShell = CreateObject("Shell.Application")
   Set objFolder = objShell.Namespace("C:\temp\temp_pic_dest\2014\09")

   For Each strFileName in objFolder.Items
       objFile.Write objFolder.GetDetailsOf(strFileName, 12) & ": " & objFolder.GetDetailsOf(strFileName, 0) 
   Next
   objFile.Close
End Function

When i try to do the same thing without diropus in the vbs script below, it works perfectly:

Dim objShell, objFolder
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace("C:\temp\temp_pic_dest\2014\09")

For Each strFileName in objFolder.Items
    Wscript.echo objFolder.GetDetailsOf(strFileName, 12) & ": " & objFolder.GetDetailsOf(strFileName, 0) 
Next

Is there a way to do this in diropus ?

Thanks in advance !

greetings

The error message should include a line number. Which line is it?

(Please re-post the script if it has been modified from the first one abovre, to ensure the line number points to the correct line.)

Leo,

The complete error message is:

datetaken_via_diropus: Error at line 42, position 8 datetaken_via_diropus: Invalid procedure call or argument (0x800a0005)

This points to the line below:

When i use another parameter than 12 (datetaken), for example 1(filesize), this works perfectly.

It seems that, when you launch a vbscript via diropus, only a subset of the extended file properties is supported.

I found a table with all the extended file properties per operating system (i am using win7):
https://www.autoitscript.com/forum/topic/157286-view-extended-file-information-in-win7-like-winxp/

greetings,

folderitem.GetDetailsOf does not appear to be a useful API, since the column numbers (2nd argument) are not properly defined and change depending on which folder you are in, the operating system, and possibly other details. I suspect the API only exists because Microsoft wrapped everything in their C++ COM object model for scripts to call, without thinking about whether it made sense for them to be able to do so. With no way for a script to find out what the columns are, there is no way for the API to be useful. (I found reports that even the properly documented things like column 1 being size are not always true in all folders/situations.)

So I would not use GetDetailsOf at all, inside or outside of Opus, as it is not reliable.

Inside of Opus, you can use Metadata.image.datetaken (or image_text if you want the date in a text format). If you don't need the script code to work outside of Opus, that's the way to do it.

Leo,

Thanks a lot for the research and advice !!

I managed to get it working using the metadata object

greetings