GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Directory Opus Open With menu + SumatraPDF. Error


#1

This issue was first discussed in SumatraPDF forums until conclusion that the developers of Directory Opus should be contacted regarding this problem.

Link to the original thread:
SumatraPDF forums

How to reproduce the problem:

1.Install Directory Opus on Windows 7 or Windows 10

2.Install SumatraPDF x64 and make it the default handler of .pdf files

  1. There must be at least 2 programs associated to open .pdf files in Directory Opus Open With menu. To accomplish that, for example, add Notepad to open with menu for .pdf files

  2. Using Directory Opus open any .pdf file using right mouse click context menu - Open With - SumatraPDF.

SumatraPDF displays this error:

Note that if .pdf file is opened from SumatraPDF itself using File - Open… dialog, no error is produced.

If .pdf file is opened using Windows Explorer context menu - Open With - SumatraPDF, no error is produced.

Error is only produced when the file is opened using Directory Opus context menu - Open With - SumatraPDF.

  1. I’ve used Process Explorer to see the full command-line i.e. exactly what parameters SumatraPDF.exe is being invoked with by Directory Opus Open with menu.

Let’s say I’m using Directory Opus to open D:\a\b.pdf with right mouse button open with menu and choose one of these PDF tools: Sumatra, Foxit, Adobe reader, PDF Xchange.

Only Sumatra has an issue. Here are the full command lines for those programs:
“C:\Program Files\SumatraPDF\SumatraPDF.exe” “D:\a\b.pdf” D:\a b.pdf

The comand line above is clearly abnormal, because of D:\a b.pdf part

“C:\Program Files (x86)\Foxit Software\Foxit Reader\FoxitReader.exe” “D:\a\b.pdf”
“C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe” “D:\a\b.pdf”
“C:\Program Files\Tracker Software\PDF Editor\PDFXEdit.exe” “D:\a\b.pdf”

All these command lines are normal.

Once again, there is something unique in the combination of Sumatra and Directory Opus.

  1. Edit Windows registry and make SumatraPDF the one and only handler of .pdf files, so there is no Directory Opus Open With menu, just the Directory Opus Open With… command and SumatraPDF will produce no errors.

I’ve tested Context menu - Open With - SumatraPDF behavior on stock Windows 7 Explorer and 3rd party explorer replacements (Total Commander, XYplorer, xplorer², Q-Dir, Directory Opus) and only Directory Opus produces the mentioned Context menu - Open With - SumatraPDF error.

However, I’ve also tested Directory Opus Context menu - Open With, with Adobe Acrobat Reader DC, Adobe Reader XI, Foxit Reader, PDF XChange Editor, Nitro Pro and only SumatraPDF produces this error.

Why does this particular combination of Directory Opus open with menu and SumatraPDF cause problems?

Thank you.


#2

On a machine where this problem occurs, please do this and attach the zip file it generates:

  • Settings > File Types
  • File > Diagnostic (i.e. the File menu at the top-left of the File Types dialog)
  • Enter PDF as the extension and click OK.

#3

Here you go, Sir!

Opus_FTD_File_PDF.zip (35.3 KB)


#4

I'd say this is the problem:

HKCR\SumatraPDF\shell\open\command: "" is REG_SZ:
    ""C:\Program Files\SumatraPDF\SumatraPDF.exe" "%1" %*"

HKCU\Software\Classes\SumatraPDF\shell\open\command: "" is REG_SZ:
    ""C:\Program Files\SumatraPDF\SumatraPDF.exe" "%1" %*"

HKLM\Software\Classes\SumatraPDF\shell\open\command: "" is REG_SZ:
   ""C:\Program Files\SumatraPDF\SumatraPDF.exe" "%1" %*"

The "%1" %* on the end means:

  • "%1" -- add the first selected file path in quotes, then...
  • %* -- add all selected file paths (including the first path again).

I think that string in the registry should only have one of those, not both.


#5

Thank you @Luthcase and @Leo for taking on this problem.

I have the exact same issue and albeit not a major dealbreaker, it is slightly annoying. I would like to understand how this works exactly. What does DOpus do when using the "Open with ..." entry? Since I cannot edit that behaviour from within DOpus it must be a Windows thing. Then again, I am confused why SumatraPDF writes those commands to the registry although it does not understand that syntax AND File Explorer uses the exact same registry entry as DOpus but produces somehow different results.

Do I see it correctly that it could be fixed by a simply registry change?

Thanks in advance


#6

We have a fix/workaround for this coming in the next update.

I'm not sure why the %* is there in the registry, but Explorer seems to completely throw it away (as does Opus in places, and most other software, when they run the command via the shell). With the Open With menu, Opus runs the command itself, and supports using %* to add extra information which apparently is only added in some situations and blank in others.

All of this is not really documented by Microsoft, unfortunately.

We aim to be compatible with Explorer where possible, so we will do the same thing and throw away the %* part, as if it was not in the registry at all (except in the cases where we know the %* needs to do something extra, where Open With menu items aren't included).

It'd be interesting to know why the %* is there in the registry and in which situations it's meant to do something extra, to fully understand how it's being used. Unless it was just copied from some other registry entries as "the way to do things" and is always meant to do nothing.

Anyway, the Open With menu will work correctly with SumatraPDF in Opus 12.9.2 and later versions.