Nee option to save all the opened files, but not to close it

Forum for the PDF-XChange Editor - Free and Licensed Versions

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Post Reply
hafeesh
User
Posts: 42
Joined: Thu Dec 13, 2018 2:31 pm

Nee option to save all the opened files, but not to close it

Post by hafeesh »

Nee option to save all the opened files, but not to close it.

This is to ensure that all the changes are saved for the opened pdf files..
but i dont want to close them.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Nee option to save all the opened files, but not to close it

Post by Sasha - Tracker Dev Team »

Hello hafeesh,

This can currently be done by executing the JavaScript in the Console (https://www.pdf-xchange.com/knowle ... nge-Editor):

Code: Select all

var activeDocs = app.activeDocs;
for (var i = 0; i < activeDocs.length; i++)
{
	var doc = activeDocs[i];
	app.execMenuItem("Save", doc);
}
Alternatively, you can create the button to do this:

Code: Select all

function saveAllOpenDocs()
{
	var activeDocs = app.activeDocs;
	for (var i = 0; i < activeDocs.length; i++)
	{
		var doc = activeDocs[i];
		app.execMenuItem("Save", doc);
	}
}

app.addMenuItem({ cName: "Save All Open Documents", cParent: "File",
      cExec: "saveAllOpenDocs()",
      nPos: 3
   });
This code will add the button to the File menu:
image.png
image.png (9.58 KiB) Viewed 1831 times
Here, you can see how to make that JS execute every time you launch the Editor:
https://www.pdf-xchange.com/knowle ... the-Editor

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
User avatar
Ovg
User
Posts: 461
Joined: Tue Sep 05, 2017 4:56 pm

Re: Nee option to save all the opened files, but not to close it

Post by Ovg »

Sasha - Tracker Dev Team wrote: Sat Jan 19, 2019 9:46 am app.addMenuItem({ cName: "Save All Open Documents", cParent: "File", cExec: "saveAllOpenDocs()", nPos: 3 });
Thanks for that very much !!! :D
It's impossible to lead us astray for we don't care even to choose the way.
PDF-XChange PRO, 10.1.1 (Build 381) / W7 SP1 x64
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Nee option to save all the opened files, but not to close it

Post by Sasha - Tracker Dev Team »

Hello Ovg,

I didn't write the state update part (disabled/enabled) though it will just do nothing if you have no documents to save - so it should suffice like that :)

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
hafeesh
User
Posts: 42
Joined: Thu Dec 13, 2018 2:31 pm

Re: Nee option to save all the opened files, but not to close it

Post by hafeesh »

Thank you very much

I will try creatign the button.
hafeesh
User
Posts: 42
Joined: Thu Dec 13, 2018 2:31 pm

Re: Nee option to save all the opened files, but not to close it

Post by hafeesh »

EUREKA !!

Thank you
Attachments
Screenshot - 26-01-2019 , 07_18_37.png
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Nee option to save all the opened files, but not to close it

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
User avatar
Jensen Head
User
Posts: 425
Joined: Mon Sep 13, 2021 8:12 am

Re: Nee option to save all the opened files, but not to close it

Post by Jensen Head »

Sasha - Tracker Dev Team wrote: Sat Jan 19, 2019 9:46 amAlternatively, you can create the button to do this: (...)
I ran this code in the console, the "Save All Open Documents" button appeared, but clicking it does not save all open, modified and unsaved documents - they still display the "changed" icon on the tabs.

For now, I use the command from the quick search:
image.png
image.png (14.42 KiB) Viewed 714 times
added it as a button to the "Quick Access" panel.

Maybe it makes sense, after all, to add this button as standard, "out of the box"?

Upd. How do I remove this button now?
image.png
image.png (918 Bytes) Viewed 714 times
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17906
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Nee option to save all the opened files, but not to close it

Post by Tracker Supp-Stefan »

Hello Jensen Head,

Just tested this custom menu command - and it worked perfectly fine for me.
Please note that this will work for files that have already been created. If you have "New Document" ones - that have not yet been saved to disk - the "Save All" command will take you to the "Save As" option instead.

Kind regards,
Stefan
Post Reply