Forum moved here!

Home / Open files from *MULTIPLE* tabs in Acrobat (or other app)

koottova

Firstly, thanks for an awesome piece of software.

Now, as it says on the tin, I’d like to have e.g. 5 pdfs open in Sumatra, and then from the file menu be able to say open ALL pdfs in Acrobat, not just the active pdf.

Could anyone help out with this?

GitHubRulesOK

Sounds simple, however I dont think its currently possible, without some scripting to gather the current files open.
You may have seen that “external viewers” can only accept one filename at a time, thus it would require a workflow of say one shortcut to add each (any) active filename at a time to a runtime list then a second trigger to send the list to acrobat.
I would be looking first at how acrobat receives the listing (a long string) ? then use external viewers to build that structure via a cmd file.
Thus you would manually use one shortcut to call the cmd for each desired gather and a second shortcut to send the gathers to acrobat

koottova

I am nowhere near an IT guy so that’s a tough nut for me to crack. But let’s assume it remains as a feature request.

OT - could you pls add one more reply to this thread so I can see that the account settings I made actually have taken place. Saying this cos emails weren’t sent at first when replies to the thread were added. Now I tweaked my settings, let’s just see if it works. Thanks in advance!

GitHubRulesOK

I can help if you struggle, it should not be too dificult, but its requires work on your part,

You need to decide how your acrobat opens two files at a time so from a CMD prompt how do you need to send an instruction like

"c:\my acrobat location\acrord32.exe" "c:\first directory\file1.pdf" "d:\another location\second.pdf"

my inital testing shows my old acrobat would open a new window for each filename but I guess more recent should use tabs.

Looking at other Acrobat DC users problems, it appears externaly opening multiple files in Acrobat tabs may be a paid for (subscription) feature and/or be a rights management problem across some netorked locations.

GitHubRulesOK

With any application such as acrobat (or edge) as default pdf handler

Then simply running a list of files will open them sequentially in tabs

Summary use one shortcut to add the filenames to a list, then run the list

SO adding one ExternalViewers command

ExternalViewers [
    	[
    		CommandLine = C:\windows\system32\cmd.exe /c echo "%1" >>"c:\some where you want it\list.cmd"
    		Name = &Add PDF to a command List
    		Filter = *.pdf
    	]

and a second as

	[
		CommandLine = C:\windows\system32\cmd.exe /c "c:\some where you want it\list.cmd"
		Name = Run my &List command
		Filter = *.*
	]
]

note “some where you want it” should not include odd characters and since the list is continuously added to but not self destroying, you could need to add a third shortcut to destroy an older list or see next post

ALT F A should add the filename to the List

ALT F L should run the List of files

GitHubRulesOK

If you want to add a self destroy ability to the list then change second entry to

CommandLine = C:\windows\system32\cmd.exe /c echo del /p "%~f0">>"c:\some where you want it\list.cmd" & "c:\some where you want it\list.cmd"

the /p will ask for confirmation once all the files are loaded

"c:\some where you want it" could be your %temp% folder so in that case replace all of those in both commands as “%temp%\list.cmd”

so the two commands would be

CommandLine = C:\windows\system32\cmd.exe /c echo "%1" >>"%temp%\list.cmd"

CommandLine = C:\windows\system32\cmd.exe /c echo del /p "%~f0">>"%temp%\list.cmd" & "%temp%\list.cmd"
koottova

Totally appreciate your effort. Don’t think Im there yet though. So we can just park it here for now and see if it ever makes it to a feature.

GitHubRulesOK

go to advanced settings find the section

ExternalViewers [
]

and copy & paste the following to replace it

ExternalViewers [
    	[
    		CommandLine = C:\windows\system32\cmd.exe /c echo "%1" >>"%temp%\list.cmd"
    		Name = &Add PDF to a command List
    		Filter = *.pdf
	]
    [
		CommandLine = C:\windows\system32\cmd.exe /c echo del /p "%~f0">>"%temp%\list.cmd" & "%temp%\list.cmd"
		Name = Run my &List command
		Filter = *.*
	]
]

Then check the file menu you should see “Open in Add PDF to a command List”
with underscore on A means the shortcut is ALT + F + A

likewise once you add those you want to your list you can run it with ALT + F + L

In my case they open as tabs in Edge which is my systems default PDF reader
but on another machine they open in Acrobat which is its default handler

the only issue is if ALT + F + A is already assigned to open 1 file in Acrobat then the shortcut may need changing

koottova

This is what I get

image

2 new entries … open in add pdf to … and open in run my … both don’t open Acrobat with 3 pdfs loaded in tabs in Sumatra

The original one called “Open in Acrobat Reader” still works but ofc opens a single pdf only.

I have Acrobat XI Pro 11.0.23.

Thank you for your drive.

GitHubRulesOK

Apologies just tested Run my list
and agreed did not work as there were two command line= on the same line but should have been just the one,
see how I have now changed above to remove the duplicate

since you have acrobat active the shortcut ALT + F + A should be used for the one file as before so to change the Multiple files to say ALT + F + T then move the & in the first command to read Name = Add &Tab to a PDF command list

The current list of tabs cant be opened automatically you need to chose each of the tabs to be opened in acrobat, use the shortcut ALT + F + T for each one then finally use ALT + F + L to start the list

koottova

Wait, did we misunderstand each other … that was the whole point till now. To have e.g. 3 pdfs opened in tabs in Sumatra and then from any single one of them go to File Menu and hit a button to open all 3 (or as many as opened) PDFs in Acrobat windows.

GitHubRulesOK

No misunderstanding, SumatraPDF is currently limited to exporting one tab name and / or page number at a time, it could be some time before there is a means to automatically list all current tabs. There have been many long term requests for such a feature.

It is not too difficult, as you preview each pdf, to decide which tabs need listing and hit ALT + F + T for each. To make that fully automatic would require much heavier scripting with users requesting “but I want to skip this tab or that tab”.

GitHubRulesOK

@koottova
Never one to give up, I think I may have your desired answer, and ALL on One shortcut ALTFT.
Note it can only work in a recent https://www.sumatrapdfreader.org/prerelease.html version unlike the one above it will not work in version 3.2 or earlier.
Beware it is a very long line and the " % and 4 tabs (the big space) are critical since the current session stores the open file names in exactly that fashion.
DO read the notes below that explain how you will need to make two adjustments for YOUR pc

ExternalViewers [
    	[
    		CommandLine = C:\Windows\System32\cmd.exe /c Find "				FilePath =" "SEE NOTES\SumatraPDF-settings.txt">%temp%\pdflist.txt & FOR /F "tokens=3* skip=3 delims= " %G IN (%temp%\pdflist.txt) DO start "" "c:\program files\SumatraPDF\SumatraPDF.exe" "%G %H"
		Name = another app ALL current &Tabs
		]
]   

NOTE to anyone copying/pasting the above command, beware when copying command lines that quotes may be changed from required simple double " marks to non working “curly quoted”

When current pre-release is running it keeps track of the current tabs in a TabStates [ area towards the end of the SumatraPDF-settings.txt. This was "not always" the case in previous versions, including 3.2.

So now we can search for the current tabs filenames by looking for those with 4 TAB characters. That is what the “Find” part does, so the big gap infront of “FilePath” is important otherwise it will find other entries not currently open.

Where it says "SEE NOTES\ then YOU need to replace that with the location of the settings file so it might be "C:\users\*your name*\appdata\local\ for a more recent installed pre-release version or if you are using a portable version it could be the folder with the SumatraPDF.exe . The easiest way to check is in Advanced settings using “Save AS” and note where that file is located.

ALSO note where I have put "c:\program files\SumatraPDF\SumatraPDF.exe" as my file handler for the tab set to be reopened you will need to replace that with wherever your acrobat.exe is located . you can usually find that by looking at the properties of an acrobat shortcut.

There are at least two restrictions to avoid with this method

  1. ALL open tabs filenames will be sent to the receiving app so if you have an epub open in a tab that name will also be sent but acrobat should just say it cant open it ?
  2. I had allowed for filenames with spaces in the filename ( previously the reason for %G…) however on revisiting this on another machine I find there seems to be a bug in the way sumatrapdf and windows handle the end part of command line so it is now %G %H and sumatrapdf/windows will add the current tab again to each line !! I cant seem to find out how to avoid that without changing the method (see alternative below) but again acrobat should ignore the extra entry.
  3. The number of tabs that can be processed may depend on how long their filenames are and possibly could fail on those with odd non latin characters. I had no problems with a set of 10 mixed files with reasonable lengths of file path. Best to keep your filename paths short and simple. (filenames with - or _ were not a problem for me, but avoid any with ! or = etc, they may not always work)

Good luck

Alternative method

to make this much easier for other uses such as simply save all current tabs to a list or a command list.
in pre-release \ SumatraPDF-settings.txt use a simpler external call, change "some where to a folder of your choice e.g. "c:\my scripts\

ExternalViewers [
	[
		CommandLine = C:\Windows\System32\cmd.exe /c "some where\CurrentTabs.cmd"
		Name = another app ALL current &Tabs
	]
]

If you want to automatically run the list like above then
copy and paste the following in NotePad and save as (without the extension .txt) “some where\CurrentTabs.cmd”

FIND "				FilePath =" "SEE NOTES\SumatraPDF-settings.txt" > %temp%\pdflist.txt
FOR /F "tokens=3* skip=2 delims= " %%G IN (%temp%\pdflist.txt) DO start "" "the target application\handler.exe" "%%G %%H"

SEE NOTES\ as per above and
the target application\handler.exe could be SumatraPDF

If you dont want to automatically run the list but say save it to use later e.g. to start SumatraPDF with a saved list then copy and paste the following in NotePad and it save as (without the extension .txt)

"some where\CurrentTabs.cmd"

FIND "				FilePath =" "SEE NOTES\SumatraPDF-settings.txt" > %temp%\pdflist.txt
FOR /F "tokens=3,2,1 delims=/" %%i in ("%date%") do set IsoDate=%%k-%%j-%%i
FOR /F "tokens=2,1 delims=: " %%m in ("%time%") do set IsoTime=-%%m-%%n-
FOR /F "tokens=3* skip=2 delims= " %%G IN (%temp%\pdflist.txt) DO echo start "" "the target application\handler.exe" "%%G %%H" >> "some where\%IsoDate%%IsoTime%SumatraPDFSavedSession.cmd

If you want it even simpler as a text list, then change second half of last line from
DO echo start "" "the target application\handler.exe" "%%G %%H" >> "some where\%IsoDate%%IsoTime%SumatraPDFSavedSession.cmd
to
DO echo "%%G %%H" >> "some where\SumatraPDFSavedSession.txt

jasee

Thanks for your reply, it seems very complicated. Fortunately, I’ve now discovered how to make favourites. These seem to survive anything! And if I then keep a backup of the settings file, I should be able simply to restore in anyway. Thanks for your post