PDF Explorer > General

Custom script keywords for directory listing and loading text

<< < (2/3) > >>

Padanges:

--- Quote ---Show me some code, if you are facing specific problems.
--- End quote ---

OK. Let's try. For the start, how do I get the promp for user input?
The lines:

--- Code: ---var message='Specify related file name mask';
var defaultValue='textFile.*';
var input = prompt(message, defaultValue);

--- End code ---
does not work. And then, how do I get the value into the log?

--- Code: ---pdfe.echo(input);

--- End code ---

Padanges:

--- Quote ---So you are talking about retrieving the metadata information stored in descript.ion files?
--- End quote ---
That could be the second step. For the start - it would be nice get any text file lines loaded into the entry info field. And how do you do that?

RTT:

--- Quote from: Padanges on August 30, 2016, 11:24:47 AM ---OK. Let's try. For the start, how do I get the promp for user input?
The lines:

--- Code: ---var message='Specify related file name mask';
var defaultValue='textFile.*';
var input = prompt(message, defaultValue);

--- End code ---
does not work.

--- End quote ---
"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.

--- Quote ---And then, how do I get the value into the log?

--- Code: ---pdfe.echo(input);

--- End code ---

--- End quote ---
That will work.


--- Quote from: Padanges on August 30, 2016, 11:26:44 AM ---
--- Quote ---So you are talking about retrieving the metadata information stored in descript.ion files?
--- End quote ---
That could be the second step. For the start - it would be nice get any text file lines loaded into the entry info field. And how do you do that?

--- End quote ---
Under the My Scripts batch tool, check the "File Summary Information to PDF metadata" sample script, for code about how to edit the metadata fields.

In the above script, that list the "family files", you have code on how to read text lines from an external file.

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  ;)

Padanges:
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?

Padanges:

--- Quote ---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  ;)
--- End quote ---
What a dirty trick!  ;D It's not a form - it' a (incognito) webpage as a form! ;D 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:

--- Code: ---*/}.toString().replace(/^[^\/]+\/\*!?/, '').replace(/\*\/[^\/]+$/, '');
--- End code ---
to this:

--- Code: ---*/}.toString().replace(/^[^\/]+\/\*!?/, '').replace(/\*\/[^\/]+$/, '').replace(/(\r\n|\n|\r)/gm,"");
--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version