Using External control codes in scripts

I think this has been discussed before.Are we able to use External control codes in a script?

I would like to be able to use a code like {filepath}, or {file}, or {file|ext} along with an Item to obtain the required text.
For Example

var myValue = Item.ProcessExternalCode("{filepath}");

When writing this script that parses the file name and extracts text to a custom column via regexp. I wanted to be able to define the input (currently hard coded to filename) via a string.
Making the config look like this

  columns: [ {
    name:"pid",
    input:"{filename|noext}",
    re: /\[(PID_\d*)]/
  }, {
    name:"Numeric Id",
    input:"{filename|noext}",
    re: /\[(\d*)\]/
  }, {
    name:"SampleNumbericExt",
    input:"{filename|ext}",
    re: /(\d*)/
  }]

Is this currently possible?

The object has methods to get all those things. There's no need to use the command codes.

Using the object methods means you need to know the value you want ahead of time. I does not achieve the use case as described in the first post, using command codes would, as they could be passed in to the method.

In the example above using command codes would allow defining outside the method the part of the filename(or path) on which to run the regexp. Currently its hard coded as filename.
Is there another way to solve this I'm not thinking of?

How to execute a JavaScript function when I have its name as a string

e.g.

FileItem = DOpus.Listers(0).tabs(0).files(0);
DOpus.Output(FileItem["realpath"]);
DOpus.Output(FileItem["name"]);
DOpus.Output(FileItem["ext"]);

Ah I had forgotten about that. Thanks that will work nicely.

Could one point me in the right direction as to where to find these codes for scripting? For example the ".." modifier's equivalent appears to be the Parent method under the Path object.

I see the Path and File objects. But I don't see, for example, destination path. So I was wondering if all of the options available in the External Control Codes portion of the manual exists in those two objects (and maybe a little regex covers the options as well).

Command.source and dest is one way to get those paths, and you're given a pre-configured Command object in the most common cases.

The Lister object also has sourcetab and desttab properties which provide another way. (At least for dual-display listers. There can be a difference with two separate windows as source and dest, if you use that.)

There isn't a direct mapping from the External Control Codes to scripting objects/methods. Scripting has an object hierarchy and allows you to do a lot more things with more flexibility, so it's organised differently.