javascript folder location button [suggestion]

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

MedBooster
User
Posts: 1070
Joined: Mon Nov 15, 2021 8:38 pm

javascript folder location button [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?
You do not have the required permissions to view the files attached to this post.
Wishlist
Bookmarks with page numbers
Optional fixed small icon size in the toolbar
Shift to UNLOCK aspect ratio/i]
Allow more "toolbars" to the title bar
AltGr issues with character input and keyboard shortcuts
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8624
Joined: Wed Jan 03, 2018 6:52 pm

Re: javascript folder location button [suggestion]

Post by TrackerSupp-Daniel »

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
Tracker Software Products (Canada) 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: 239
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: 239
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
TrackerSupp-Daniel
Site Admin
Posts: 8624
Joined: Wed Jan 03, 2018 6:52 pm

Re: javascript folder location button [suggestion]

Post by TrackerSupp-Daniel »

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
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com