Make it possible to open a specific file in the current window instead of a new window when tabs are disabled
Currently (version 3.1.2) if UseTabs is false, both ReuseInstance setting and -reuse-instance command-line option don't let to open a new file in the same window using either CLI, or DDE.
<Ctrl>+<Shift>+Right/Left keyboard shortcuts provide such an opportunity, but only for files in the same folder and in sequential order.
Please provide such an opportunity for any file.
Link to the corresponding topic in the forum: https://forum.sumatrapdfreader.org/t/make-a-new-file-open-in-the-current-window-instead-of-the-new-window/1574.
@kjk
Some other LaTeX PDF pre-viewers offer a command line option to keep a single window open such as Okular.exe -unique "varying-file.pdf" this would in effect be similar to using SumatraPDF in a plugin mode where the window is a static frame and variable contents are passed to that one session.
@DfM7 ( + @kjk ?)
SumatraPDF now (pre-release) should honor a full set of DDE cmds so perhaps this issue is now addressed
From previous forum issue was
I’ve set ReuseInstance to true and UseTabs to false. But if I call "...\SumatraPDF.exe" "...\1.pdf" and then call "...\SumatraPDF.exe" "...\2.pdf", Sumatra PDF opens a second window. However, when I call "...\SumatraPDF.exe" "...\1.pdf" twice, no second window is opened. And that’s what I want to achieve, but with different files. P.S. I’m trying everything in a maximized state of the window (WindowState = 2), as I don’t have a second monitor right now.
Thus the issue as described for desired behaviour was/is
- call "...\SumatraPDF.exe" "...\1.pdf"
- call "...\SumatraPDF.exe" "...\2.pdf",
- Desire that file 2.pdf replaces file 1.pdf in the one window (without using tabs)
- scriptable via Either CLI or DDE
With CLI this is still NOT possible via current pre-release with any settings (historically and logically each call uses different windows) There is no external close current file
- NoHomeTab = false or true
- ReuseInstance = true or false
- RestoreSession = true or false
Acrobat Reader has exactly the same behaviour, however there has been, for a long time, an external w32TeX CLI method using DDE to close 1st and open a 2nd file (Note the first must have been opened by PDFopen.exe). This is common method for acrobat DDE since Acrobat locks files open and there should be no taskkill
pdfclose 1.pdf & pdfopen 2.pdf
It uses a settings file pdfddeservername.txt but I have never tried to see if the settings could be adapted to SumatraPDF, the main exe would probably need edits or compile from altered source files.
So for SumatraPDF with DDE this should also be possible as [open file 1... then [close file 1 ] [open file 2 ] if the close does not exit mid session.
So back to CLI>DDE.exe (6 KB cl-2-dde_dbg-1.0.0.1) cl-2-dde_dbg-1.0.0.1.zip which was designed by Andrej Kulikov with Excel and SumutraPDF [sic] as an example (unclear what that last debug error message is about?)
Now that commands can be sent we can send 2 in a row, note the logical oddity we open 2.pdf and close 1.pdf (thus always maintaining the channel open). If we close then open there would be a noticeable fade and then replace time lag. Also note there is literally a side effect as the second window will be offset from the first ! (Edge does not do that !), But that is a separate open issue.
dde @# #Sumatra# #control# #[Open("2.pdf", 2, 1, 0)][CmdClose]#
Closing as desired sequence achieved in 3.5