Select/Highlight Currently Displayed Image From Image Viewer

If I use the built-in image viewer to view images and start scrolling through the images in a folder, are there ways for to select or highlight the currently viewed image in the lister? This would make it easier to know my current placement in the lister rather than scrolling through (say 100 images) in the image viewer, become interested in copying an image or adding it to my multiple file selection, then try to scroll through the list and find that image (either visually through thumbnails, filenames, or FAYT) that is being displayed, and then finally select/add it to file selections.

+1 in case it cannot be done with the new viewer? o)

Is there a way to achieve that with v12? Overloading the next/prev triggers with a "Select EXACT " or something?

Your reason given for wanting this is addressed by the "mark" function I would have thought?

Not exactly I think. Marking a picture does not help locating it (quickly) in between the others, in case I do it wrong, correction is appreciated! o)
I see several steps involved with the "mark" function.

  • mark the picture
  • close viewer
  • copy filename from image in mark collection
  • close mark collection and switch back to images location tab
  • open fayt/filter bar and paste filename -> item selected finally

In comparison to what we think of:

  • press a specific key or just close viewer -> item selected

It's not always just about getting the image name, you often need to see "where" in the list of images your chosen image is to be sure it's the correct one you picked.
There can be sidecar files you're looking for e.g., or in case you made dozens of similar shots you just "know" the one you're looking for is somewhere at the top/bottom of the list, but you need to "see" first to be sure. Means: Look/choose picture by using the viewer first, then double check by evaluating position of image in between others.
Ever took 200 shots of the same thing because you want to put it up on eBay (with flash on/off, forgot to add an item, reposition items once more etc.)?
Then maybe you know. o)

We had a little talk about applying labels to images directly from the viewer, guess it cannot be done yet? I think that would also help to locate an image more quickly (by sorting the labels/status column or something), but would still require additional tasks compared to the option of going to/selecting the last viewed imaged directly.

I can't see any reason a script, run via the viewer toolbar or via a hotkey, shouldn't be able to select the viewer's current file in a folder tab. Haven't tried writing the script, but can't think of anything that would get in the way.

Applying labels should work with basic commands and not even need a script, unless I've forgotten something. The discussion we had was about displaying the current label state in the viewer, which I don't think currently works.

Would that potential script be able to automatically scroll the lister down to precisely where the file being viewed in the image viewer is and then select/highlight it as well? Because that's what I'm asking about and since I'm not much of a programmer, it would be a bit harder for me to start with it.

Since the built-in image viewer is very powerful, I'm sure photographers would use it very often. The capability of it to mark/tag the file directly while viewing the image is very useful. But having the lister to scroll exactly to the image being viewed is also very useful if you want to double check the file being viewed and also perform more minute control and operations per file and operations in a folder of hundreds or thousands of pictures.

Yes, it could do that

Yes, I remember. You're right. o)

Can you give a hint on how to fetch the filename of the currently viewed image?
I guess I can think up the rest myself, just don't know where to start from. Ah, wait, maybe that new Viewer object?

You may get a normal folder tab object set up as if the viewer is a tab with a single file selected, although I'm not sure actually.

If not that then I'd expect the clickData object you're given to have a way to get the current viewer so you don't have to find it yourself by looping through the global list of viewer objects (although that is also an option).

Not at my PC to check exactly what happens at the moment, but maybe that helps experiment.

Back at my PC now. clickData.func.viewer.current will get you the viewer's current file.

Sounds good!

Since like I said before, I'm not much of a programmer. From copying and pasting part of examples I have found, my script so far looks like this:

@script jscript Function OnClick(ByRef clickData) ViewedFile = clickData.func.viewer.current; clickData.func.command.ClearFiles(); clickData.func.command.AddFile(ViewedFile); clickData.func.command.RunCommand("Select FROMSCRIPT DESELECTNOMATCH MAKEVISIBLE"); End Function
Gives me an error:

Error at line 2, position 10 Function OnClick(ByRef clickData) ^ Expected ';' (0x800a03ec) Parse error - script aborted
I will try fixing it later once I get back home again.

However I still think that in future version of DOpus, it would be a nice and useful function to have built-in into the image viewing window without requiring new users who needs it to script it out. Would work really well with the mark/tag functions (as long as you don't clear the current selections which I believe that is what the clickData.func.command.ClearFiles() does).

Thanks Leo! o) After experimenting a bit..

"clickData.func.viewer.current" works! o) It's tricky to always select the image in the correct tab though, since getting the last active lister and active tab, does not make sure it's the tab the image was opened from. I assume there's no bullet proof way to select the image in the correct tab without knowing the tab itself? If I'm correct, could you also expose a valid data.func.sourcetab object in case OnClick() is fired from the viewer toolbar? It evaluates to "0" right now. Not knowing if that's desired behaviour?!

I thought about saving the last viewed image in a global variable, to be able to "select" it even after I've closed the viewer.
But this can only be done if I know when the viewer is about to close, so the variable needs to be set right before running Show VIEWERCMD=close or hitting . Unfortunately still seems to be hard wired, does it need to be? If not, then the "File -> Close" menu on the toolbar seems a good place to bind "" and inject some commands to run whenever the viewer is about to close. Does anybody not use for closing the viewer? Guess not, so it seems an important "event" for doing some automation magic.

I also noted that the key seems to be hard wired to "drag image". is quite an important qualifier for shortcuts, I'd prefer as it meets well known adobe/photoshop standard and also clears this key for custom use. I ran into because:
I setup to select the current image and my next idea was to also close the viewer if is pressed additionally. Unfortunately it cannot be done by defining a hotkey using the key nor by testing the qualifiers string, since its hard wired nature. Did not find a setting to change that, is there?

Nonetheless, this is very promising, with some tweaks it really opens new doors! Like it! o)
This is what I ended up with for now. Very basic, since finding the correct tab is guessing, testing shift-qualifiers failed and setting global variable on closing the viewer failed as well. o) But nonetheless:

function OnClick(data){ var curItem = data.func.viewer.current; data.func.command.RunCommand('Select DESELECTNOMATCH EXACT MAKEVISIBLE "'+curItem.name+'"'); }
Btw: The "Listers" object and its methods/props do not seem to be documented, there's only a short mention in the "DOpus" object and the description of its listers collection.

Wait. I just tested that script but it does not work for me. Is it because I'm on version 11? Just to verify, I create a custom button in the image toolbar, go to advanced so that I can input a script function, and then input:

[code]@script jscript

Function OnClick(data){
var curItem = data.func.viewer.current;
data.func.command.RunCommand('Select DESELECTNOMATCH EXACT MAKEVISIBLE "'+curItem.name+'"');
}[/code]
Correct right? Because it's giving me:

Error at line 1, position 23 Function OnClick(data){ ^ Invalid character (0x800a0408) Parse error - script aborted

If without "@script jscript", it would give:

Error at line 3, position 10 Function OnClick(data){ ^ Expected ';' (0x800a03ec) Parse error - script aborted

Viewer scripting requires the Opus 12 beta.

My 2nd try using my previous script resulted in:

[code]@script jscript

function OnClick(clickData) {

ViewedImage = null;
ViewedImage = clickData.func.viewer.current;

dlg = clickData.func.Dlg;
dlg.message = "The Viewed Image Is '" + ViewedImage.name + "' - " + ViewedImage.size.fmt;
dlg.buttons = "Select It|Cancel";
dlg.icon = "info";
dlg.title = "Viewed Image";

if (dlg.Show() == 1) {
    clickData.func.command.ClearFiles();
    clickData.func.command.AddFile(ViewedImage);
    clickData.func.command.RunCommand("Select FROMSCRIPT DESELECTNOMATCH MAKEVISIBLE");
}
else {
    clickData.func.command.deselect = false;
}

}[/code]

Gave me this error:

Error at line 6, position 5 'func.viewer.current' is null or not an object (0x800a138f)

Aaargh! I don't know what I'm doing!

Ah! So that's the problem. I opened this thread in the first place asking if it's possible to do it in Opus 11. Apparently that's a clear no.

In the Opus 11 viewer, Edit > Tag File (Ctrl+T) is the closest thing to what you want:

The Tag File command is useful when you want to vet a collection of images - you can step through them one at a time in the viewer, and use the Tag File command (or press Ctrl+T) to tag the images you want to keep. This has the effect of putting the parent Lister into Checkbox mode; images you tag will be automatically checked for later processing.

Great so now I'm a bit worried. The reason is I bought Opus back sometime in November or December so not really sure whether I would be eligible for an update to 12 once it comes out.

On an unrelated note, is just me but you can't edit your posts in this forum?

Oh. I just saw a new post right as I submit my post.

[quote="leo"]In the Opus 11 viewer, Edit > Tag File (Ctrl+T) is the closest thing to what you want:

The Tag File command is useful when you want to vet a collection of images - you can step through them one at a time in the viewer, and use the Tag File command (or press Ctrl+T) to tag the images you want to keep. This has the effect of putting the parent Lister into Checkbox mode; images you tag will be automatically checked for later processing.[/quote]
Yes I found out about this feature earlier today this but not exactly ideal for my situation. Whatever I guess I will just have to continue to use that for now.

I think the standalone viewer knows which folder tab (if any) opened it, so we could probably expose that as a property. But there's no guaranteeing the viewer was opened via a lister, though, nor that the folder tab it opened from still exists or is still in the right folder, so there will always be cases where the script might have to search through the other listers/tabs and/or open a new one.

[quote]I thought about saving the last viewed image in a global variable, to be able to "select" it even after I've closed the viewer.
But this can only be done if I know when the viewer is about to close[/quote]
An OnViewerClose event might make sense.

Shift only affects the left mouse button, and would only drag if you had the button set to Select Clipboard Region.

It's been the case for about 10-15 years and nobody has complained. :slight_smile:

Space advances to the next image, which is much more common with image viewers, so I don't think using it to toggle dragging would be a good idea.

Shift should only change what the mouse buttons do and should not affect hotkeys.

A Ctrl-Shift-G hotkey should work, and does here. I set one to run "Help ABOUT" and pushing it in the viewer opened the About dialog. The default config has Ctrl+Shift+S (Save As) hotkey, which is also working here.

Making a Ctrl-G hotkey check if Shift is held down should not work since the Ctrl-G hotkey should not be run if shift is held down (same in a lister).

It's just a collection of Lister objects. How collections work depends on the scripting language. We document the Lister objects it contains, but not the collection itself as collections are part of the scripting language.

We document our own custom collection-like objects (Vector, Set, and so on) which are used in a few places instead of native collections, since they're part of Opus, but not the native ones. Since documentation on Windows scripting is so bad, maybe we could provide a page with collection examples in JScript and VBScript. (Of course, we can't document collections for all the other languages people might install.)

See the FAQs, bottom section. :slight_smile: