Hi,I want to write a script which by given BatchFile.Filename looks in current file directory for other files with the same name but different file extensions (let's call them "family files" ) and returns the number of them. How can I do that?In addition to that, is it possible to load text lines into BatchFile.Filename DB entry's Info field if it finds file (among those listed) named, for example, "descript.ion"?

I want to write a script which by given BatchFile.Filename looks in current file directory for other files with the same name but different file extensions (let's call them "family files" ) and returns the number of them. How can I do that?

OT: Do you have experience with any coding language?

Here is a My Scripts script that works on that idea. For all the files selected in the grid, it will find the "family files" and report the number and names, if any found.

No, the filename field is read only, and I'm not getting the idea here!

I'll try to say it differently: the idea is to have a column "Description" which would for a current entry look for *FileName*.description.txt (or, in general, for a "descript.ion" file) in the parent folder and (if the file exists) load the file content into the DB info field.

OK, after checking-out your code I realized how can we make two quite general and useful tools: 1) Common folder files; 2) load entry info from file.

1) First of all, I need to get "related file" file mask prompt, where the mask default is "filename.*" (other possible cases: "filename.anyExactExt", "*.anyExactExt", "anyExactFilename.anyExactExt", "*.*"). Then to get common folder file list for the given pattern (excluding the current grid entry filename file from the list). Finally, print such results: $gridEntryFilename has $resultListFileCount related files: $resultList.

2) Get the filename and column name promt, where user specifies "ANYexactFILENAME.ANYexactEXT" and chooses current layout custom info field from combo-box. Then search for the given $filename in common folder and load it's content to given $column entry field. Finally, print such results: $gridEntryFilename related info file loaded; or: $gridEntryFilename related info file not found.

I'll try to say it differently: the idea is to have a column "Description" which would for a current entry look for *FileName*.description.txt (or, in general, for a "descript.ion" file) in the parent folder and (if the file exists) load the file content into the DB info field.

So you are talking about retrieving the metadata information stored in descript.ion files?It seems these files don't have a fixed specification, so it would be tricky to parse the various variants. For descript.ion files with "Filename" "description" lines, doesn't seems too complicated to create such a script to put all the description data in a description named field. Have you tried already? Show me some code, if you are facing specific problems.

"prompt" is a method of the global root object "window", when scripts are running in a web browser. The My Scripts don't have this global root object, and that method is not implemented in the My Scripts pdfe root object.The VBScript engine implements the InputBox and MsgBox (this one also directly available from pdfe.MessageBox) methods and here is a nice trick to make these available from JScript too.

OK! The I/O procedures are working now. Thanks! I expect no trouble with the rest of the first tool code. It should take a couple days to finish it and to test it out properly.The second tool requires to get: 1) the current grid layout custom field column name list 2) the current the entry (pdfe.SelectedFiles(i)) info by specified custom field name (title?) 3) to change that entry

Following your example in the "File Summary Information to PDF metadata" sample script I found that you predefine Column names using "FIELDS = ['Title', 'Subject', 'Author', 'Keywords', 'Comments'];". But can you get the list of current grid layout custom field column names? You also use Arguments property ("var Filename = pdfe.Arguments(i);") which in documentation is descibed as "Provides access to the entire collection of command-line parameters, in the order in which they were originally entered." while FileSummary ("var Summary = FileSummary.Read(Filename);") is undefined at all - but, I'm afraid, that doesn't help much. And finally, if I'm correct, to change an entry, you have to assign values and execute "FileMetadata.CommitChanges();". Could you help to find out how can we reference a specific column entry and the column name list?

And check the "Merge by filename part match" sample script (check this forum topic for the history behind it) for ideas on how to develop a GUI for the tool

What a dirty trick! It's not a form - it' a (incognito) webpage as a form! Thanks for sharing an idea but i prefer to continue with the MsgBox() code. Now, I just have to figure out how do I get that combo-box in there...By the way, to resolve some code portability issues, you have to change line:

var FieldsInfo = pdfe.MetadataFieldsInfo;for (var fIndex = 0; fIndex < FieldsInfo.count; fIndex++) { pdfe.echo(FieldsInfo(fIndex).caption + ' : ' + FieldsInfo(fIndex).PropertyName);but there is no specific access to just the list of columns in the current grid layout, even because what changes when the script edits the metadata is the metadata stored in the DB and, eventually, in the file itself. The grid only reflects these changes.

Quote

You also use Arguments property ("var Filename = pdfe.Arguments(i);") which in documentation is descibed as "Provides access to the entire collection of command-line parameters, in the order in which they were originally entered."

This property exists only for compatibility with the WSH WScript Object, and contains the list of selected files. This way you can drop many readily available WSH scripts, and they will run without major changes.

Quote

while FileSummary ("var Summary = FileSummary.Read(Filename);") is undefined at all

You will find the implementation of the FileSummary object under the sample libraries, "File Summary Info" script. The main script links to that one, using the includes functionality.

Quote

And finally, if I'm correct, to change an entry, you have to assign values and execute "FileMetadata.CommitChanges();". Could you help to find out how can we reference a specific column entry and the column name list?

As said above, there is no way to know just what columns are showing. Why do you need to know that, when you have access to all the fields?

As said above, there is no way to know just what columns are showing. Why do you need to know that, when you have access to all the fields?

I was thinking about a combo-box which gives the list populated only by visible column names. Can we read visible column names from a layout grid data file?

Quote

but there is no specific access to just the list of columns in the current grid layout, even because what changes when the script edits the metadata is the metadata stored in the DB

Please correct me if I'm wrong, but columns in PDFe are PDF object metadata fields (excluding: F,FS,AN,FP,DL,DS,FD,NP) appended with the Custom fields and listed in the order of their creation? And if (saved) layout grids simply toggle their visibility then custom grid layout lists those columns which are real DB fields - in other words, removing a custom field removes its column from all the grid layouts at the same time?

Quote

You will find the implementation of the FileSummary object under the sample libraries, "File Summary Info" script.

Honestly, I still can't get my head around this... I need something like this:

The layouts definitions are kept in the registry, at: HKEY_CURRENT_USER\SOFTWARE\PDFExplorer\GridLayout

Quote

Please correct me if I'm wrong, but columns in PDFe are PDF object metadata fields (excluding: F,FS,AN,FP,DL,DS,FD,NP) appended with the Custom fields and listed in the order of their creation? And if (saved) layout grids simply toggle their visibility then custom grid layout lists those columns which are real DB fields - in other words, removing a custom field removes its column from all the grid layouts at the same time?

Grid layouts just define how the full available metadata returned from a DB query is displayed.

Quote

Honestly, I still can't get my head around this... I need something like this:

The My Scripts API doens't take into account anything related to the grid layout. Things are just not connected. If you explain better what you want to achieve, maybe I can give you some workaround ideas.But here is a dirty hack script that uses the last running session grid layout information (there is no way to know what's the current session layout), to list the data. Have fun

The VBScript engine implements the InputBox and MsgBox (this one also directly available from pdfe.MessageBox) methods and here is a nice trick to make these available from JScript too.

I've been using and occasionally modifying this code for a while now, but I haven't found out how to change/remove the (msgbox/edit) window icon in the upper left corner. I think it should be dependent on the main app (icon set) which is our PDFe. Maybe you have had tried to sort this out?