Script support for determining how a file will be viewed by SHOW

File types with associated preview handlers can be displayed with the standalone viewer using the SHOW command. For example, on my system a .dcf file displays as text and a .pdf file displays as it would look when printed or opened with a PDF application. Some other file types, e.g. .exe, are displayed as hex and unknown file types display an "Unable to load picture" message.

From within a script it would be useful to be able to determine which category a file item falls into - Displayable/Hex/Unknown. Perhaps the ITEM object could be extended to provide this information?

What type of thing would you use that for, so we have an idea?

I am developing a script that allows the user to browse through a series of files some of which can be viewed natively (e.g. images, movies, PDFs, text files), some as hex (e.g. .exe files) and some where viewing natively or as hex is not available. I can use existing techniques such as item.ingroup("grpname") to establish viewability or make an educated guess, but I imagine that per-item viewability varies from system to system depending on what plugins are configured and what applications are installed (e.g. MS Office, Adobe Reader, etc..).

1 Like

It will vary a bit from system to system, but I'm still not really clear on why you'd need this? It'd be quite a lot of work to add without a really clear use-case.

e.g. What are you doing where using the file type groups + maybe some hardcoded extensions wouldn't suffice? Why would you need to list files which the viewer can display in a script?

EDIT: Another issue is that we could not really tell you for sure if a file was going to successfully load into the viewer without actually trying to load the file. Especially with third-party viewers like Word, it's possible the viewer is installed but broken (pretty frequent, in fact), so it would say it can view a file but would fail to when it actually came down to it (until the Word install was repaired).

Nothing that can't be handled that way. :blush:

1 Like