Skip to main content
October 5, 2012
Question

choose folder default location

  • October 5, 2012
  • 1 reply
  • 5480 views

Hi,

I've been searching the forum to try and a way to allow a user to choose a folder from a default location. I thought I had found the solution but it's not quite working as I wanted:

#target illustrator

//Example 1

var output_folder = Folder.selectDialog ('Choose PDF output folder.');

//Example 2

var myFolder=Folder(app.activeDocument.path).selectDlg("Choose PDF output folder:");

If I use the code in example 1 the choose folder dialog appears and the 'Open' button is available and when I press the button the location is chosen as expected. However if I use the code in example 2, although the choose window opens in the path of the active documents location the 'Open' button is not able to be pressed until I select a folder., which means that the chosen location is not correct. I should indicate that I'm running this code on a Mac.

Does anybody know a way to have a choose folder dialog window specify a location and be able to select that.

Thanks,

Nik

This topic has been closed for replies.

1 reply

CarlosCanto
Adobe Expert
October 5, 2012

it works fine in Windows

October 5, 2012

Hi Carlos,

just found something very strange and it looks to be due to the folder path.

//Example1

var myFolder=Folder("/Users/nikj/Desktop/nik").selectDlg("Choose PDF output folder:");

//Example2

var myFolder=Folder("/Users/nikj/Desktop/nik.1").selectDlg("Choose PDF output folder:");

If I run Example1 then the script opens a window in the 'nik' folder and the 'Open' button is able to be pressed.

If I run Example2 then the script opens a window in the 'nik.1' folder but the 'Open' button is greyed out.

It can't be that the path is invalid or it would not open in that path but it seems to have some issue with a path that has a full point in it!!!

Thanks,

Nik

October 5, 2012

Don't be starting a platform war on October 5th… It's year today… a true Legend…