folder location button for JavaScript/stamps etc. [suggestion]

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

Moderators: Daniel - PDF-XChange, PDF-XChange Support, Vasyl - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

Post Reply
MedBooster
User
Posts: 1372
Joined: Mon Nov 15, 2021 8:38 pm

folder location button for JavaScript/stamps etc. [suggestion]

Post by MedBooster »

viewtopic.php?p=177071#p177071''
image.png

could you please add a button under this part of the preferences that would open the javascript folder in the Windows file explorer program?
Last edited by MedBooster on Sun Dec 01, 2024 11:29 am, edited 1 time in total.
My wishlist https://forum.pdf-xchange.com/viewtopic.php?p=187394#p187394
Disable SPACE page navigation, fix kb shortcut for highlighting advanced search tool search field, bookmarks with numbers, toolbar small icon size, AltGr/Ctrl+Alt keyboard issues
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 10888
Joined: Wed Jan 03, 2018 6:52 pm

Re: javascript folder location button [suggestion]

Post by Daniel - PDF-XChange »

Hello, MedBooster

As I mention in that other thread, the JS folder does not exist by default, and they are two different locations, so making a link to open these would not likely be added, but I will bring the idea to the Dev team for consideration.

Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Mathew
User
Posts: 562
Joined: Thu Jun 19, 2014 7:30 pm

Re: javascript folder location button [suggestion]

Post by Mathew »

This script may help. Most of the code is just to make the dialog. You'll get a security warning if you want it to open the folder.
Run it in the JavaScript console:

Code: Select all

{
// dialog data
const dialog = {
	data:[],
	initialize: function (dialog) {
		let dLoad = {};
		// add the paths to the dialog
		dLoad["apth"] = this.data[0];
		dLoad["upth"] = this.data[1];			
		dialog.load( dLoad );
	},
	commit:function (dialog) { // called when OK pressed
		console.println( this.data.join("\n") );
	},
	aLch:function (dialog) {
		this.pFolder(this.data[0]);
	},
	uLch:function (dialog) {
		this.pFolder(this.data[1]);
	},
	pFolder:function (url) {
		app.launchURL( url.replace(/[\/\\][^\/\\]+$/,"") ); 
	},
	description: {
		name: "Javascript Folder Locations", // Dialog box title
		elements:
		[{	type: "static_text",
			name: "If these folders do not exist, create a 'JavaScripts' folder in this location.",
			width: 500,
			bold: true
		},
		{	type: "cluster",
			name: "App folder",
			align_children: "align_left",
			elements:
			[{	type: "edit_text",
				name: "App Folder",
				alignment: "align_fill",
				item_id:"apth"
			},
			{	type: "button",
				name: "Open Containing Folder",
				item_id:"aLch"
			}]
		},
		{	type: "cluster",
			name: "User folder",
			align_children: "align_left",
			elements:
			[{	type: "edit_text",
				name: "User Folder",
				alignment: "align_fill",
				item_id:"upth"
			},
			{	type: "button",
				name: "Open Containing Folder",
				item_id:"uLch"
			}]
		},			
		{	type: "ok",
			alignment: "align_right",
			ok_name: "Done",
		}]
	}
}
// get both paths
let jPaths = ["app","user"].map( j => app.getPath(j,"javascript") );
// change url to windows path
if ("WIN" == app.platform ) {
	jPaths = jPaths.map( j => j.replace(/\//g,'\\').replace(/^(\\[A-Z]+)/,"$1:") );
}
dialog.data = jPaths;
app.execDialog(dialog);
}
Mathew
User
Posts: 562
Joined: Thu Jun 19, 2014 7:30 pm

Re: javascript folder location button [suggestion]

Post by Mathew »

... and I agree: It would be nice to have something like this as part of the preferences.
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 10888
Joined: Wed Jan 03, 2018 6:52 pm

Re: javascript folder location button [suggestion]

Post by Daniel - PDF-XChange »

Hello again!

The dev team liked the idea, and after a little back and forth, we have made this ticket for you:

RT#6819: FR: Add "open JS folder" to JS console toolbar

Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
MedBooster
User
Posts: 1372
Joined: Mon Nov 15, 2021 8:38 pm

Re: javascript folder location button [suggestion]

Post by MedBooster »

hmhm has this been implemented yet, or did you put the button somewhere else than under preferences?

PS: this request about folder location button would pretty much apply to all tools that have a specific folder

e.g. I would also insist on having a button like this for
1) Text to speech
2) Stamps ( %appdata%\Tracker Software\PDFXEditor\3.0\Stamps)
My wishlist https://forum.pdf-xchange.com/viewtopic.php?p=187394#p187394
Disable SPACE page navigation, fix kb shortcut for highlighting advanced search tool search field, bookmarks with numbers, toolbar small icon size, AltGr/Ctrl+Alt keyboard issues
User avatar
rakunavi
User
Posts: 1643
Joined: Sat Sep 11, 2021 5:04 am

Re: javascript folder location button [suggestion]

Post by rakunavi »

Hello MedBooster,
MedBooster wrote: Sun Dec 01, 2024 11:23 am hmhm has this been implemented yet, or did you put the button somewhere else than under preferences?
Since build 386, it has been added to the JavaScript console toolbar as "App-Level Scripts..." command (ID: cmd.jsConsole.openFolder), exactly where the title of the ticket says it should be.

  • figure1.png

    ID: cmd.jsConsole.openFolder
    ID: cmd.jsConsole.openFolder
Best regards,
rakunavi
TOP desires for PDFXCE
forum.pdf-xchange.com/viewtopic.php?t=39665 LassoTool
forum.pdf-xchange.com/viewtopic.php?t=38554 CmtGarbled
forum.pdf-xchange.com/viewtopic.php?t=37353 FulScrMultiMon
forum.pdf-xchange.com/viewtopic.php?t=41002 DisableTouchSelect
Post Reply