• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Extension Pathing Question

New Here ,
Nov 03, 2021 Nov 03, 2021

Copy link to clipboard

Copied

I wrote an extension for indesign that basically just runs a script via a panel. The extension opens a panel with a button and the button will fire off the script. I used an extension so I can bundle the dependent files necessary for the script all in one and makes installation easier for the people I need to use this.

 

My issue is the platform pathing. The extension was written for Macs and works great with Macs, however, I now need to expand this for use with PCs, except I do not have a PC to troubleshoot and it is not working with the clients I have sent this to. Panel will open but clicking the button does not fire off any script. Can anyone shed some light on the necessary pathing requirements to get the below information to work.

 

 

path = location.href;
	if(getOS() == "MAC") {
		path = path.substring(path.indexOf(":")+3,path.indexOf("index"))
		alert(path)
	}
	if(getOS() == "WIN") {
		path = path.substring(8, path.indexOf("index"));
		alert(path)
	}

 

At initialization the extension runs this bit of js and will get the Path to the index.html file and then alter it so its just the location of the base extension folder.

 

For Mac it was returning file:///Users/etc so I had to cut off the file:/// part to get the paths to work. (i used 8 for windows as that is what I saw elsewhere). What do i need to do to get windows pathing to work or is there a better way to handle this procedure?

TOPICS
Scripting

Views

72

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 03, 2021 Nov 03, 2021

Copy link to clipboard

Copied

LATEST

You could use the following to get the path of extension

var csInterface = new CSInterface();
csInterface.getSystemPath(SystemPath.EXTENSION)

-Manan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines