Skip to main content
Known Participant
October 27, 2015
Answered

Current folder?

  • October 27, 2015
  • 1 reply
  • 1960 views

Hi guys,

I was trying to find the current folder, but I couldn’t 😕😕

Folder.Desktop = Desktop (Win and Mac)

My little question is:

- How can I send to JavaScript the current folder?

(No path, just the folder where I am woking on to use external .jsx files)

Many thanks in advanced!

This topic has been closed for replies.
Correct answer Qwertyfly___

Hi guys_

Using "$.fileName" I can extract the "path" + "fileName"

- Ex: C:\Test\myFile.jsx

But I just need to extract the path, not the file name and extension.

- Ex: C:\Test\

Thanks my bros!


var myPath = $.fileName.substring(0,$.fileName.lastIndexOf('/'));

alert(myPath);

1 reply

Disposition_Dev
Legend
October 27, 2015

edit.. woops. i totally misread the question.

what's the end goal? you want to point to a particular folder that's holding the JSX file? Or you want to point a particular JSX file to an illustrator file and run the script on that file?

PuthoskeyAuthor
Known Participant
October 27, 2015

For now, at work I can’t install anything and have to run my .jsx file from my USB.

Ex… saveFiles,jsx file is the main form that runs the toEPS.jsx file in the same folder

witch contains binary code.

I try to do this to protect some files… because of this, I would like to know how to

get Current Folder instead of a full path (H:\Folder\Folder)

Disposition_Dev
Legend
October 27, 2015

i guess I'm still misunderstanding. what is the current folder you're looking for? the folder that contains the active illustrator document? or the folder that contains the jsx?

are you just looking for the name of the folder for some type of validation? If not, in order to do anything with that folder you're going to need the whole path (or at least a relative path).

can you give me a list of steps you're looking to accomplish? perhaps that will clarify for me, so I can be of more help.