Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
it works fine in Windows
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
it still works fine in Windows with "dots" in the folder name
try this
var myFolder = New Folder("/Users/nikj/Desktop/nik.1").selectDlg("Choose PDF output folder:");
Copy link to clipboard
Copied
Hi Carlos,
Still no go, have a look at the screen grabs below. Whenever a period is in the filename/path the 'Open" button becomes inactives until you select a folder!!!
The below image is how I was expecting it to work
Thanks,
Nik
Copy link to clipboard
Copied
bummer, lets see what Mark the Legend has to say about this mac nonsense
Copy link to clipboard
Copied
Carlos,
Mac and nonsense are two words that should never be spoken in the same sentence. I'm not going to start a Mac vs PC war so I'll refer to it as Adobe nonsense!!!
Seriously, thanks for your help as always,
Nik
P.S. I loved the Planet of the Apes pic on the other post, made me laugh!
Copy link to clipboard
Copied
mac vs pc Round 1 - choose a default folder
Copy link to clipboard
Copied
Carlos,
I said I didn't want to start a war now please if you're not careful I'm going to let you help me again.
choose a default folder:
• pcs - oops I've got a virus
Copy link to clipboard
Copied
1,400 post!!! yey!!
ok, I let you win this "battle" for now ...
Copy link to clipboard
Copied
Don't be starting a platform war on October 5th… It's year today… a true Legend…
Copy link to clipboard
Copied
what's on October 5th Mark? some British holiday?
Copy link to clipboard
Copied
Tut tut… don't you start that tone Carlos…
The 7th is my birthday… 4 and a half…
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Nik, I don't see any problems when running your examples… Both do what I expect to see regarless of OS. You have use 2 different methods of folder selection… and as the guide says one pre-selects the folder hence ( the blue button )… The other naviagates to a location but does NOT pre-select a folder ( no blue button ) until you do so? Your dot has nothing to do with any of this…
Copy link to clipboard
Copied
Mark,
I had read this and was quite happy to accept that as the case, but running the same line of code on a folder path that contains a period and one that doesn't gives me different results, with regard to the open button. I know in my first post I used the .selectDialog for one method and .selectDlg for the other but simply running this:
var myFolder=Folder("/Users/nikj/Desktop/nik").selectDlg("Choose PDF output folder:");
produces a dialog window with the 'Open' but active, but running on a folder path that has a period in it doesn't, well for me at least.
var myFolder=Folder("/Users/nikj/Desktop/nik.1").selectDlg("Choose PDF output folder:");
Thanks,
Nik
Copy link to clipboard
Copied
Hi Guys,
I may have an answer! If I run the code in ESTK 4.2.12 with Illustrator CS6 as the target it works fine but running it in ESTK 4.1.23 with Illustrator CS5 as the target produces the inactive 'Open' button result. If you are able to test this Mark I would appreciate it.
Thanks,
Nik
#target illustrator
var myFolder=Folder("~/Desktop/nik.1").selectDlg("Choose PDF output folder:");
Copy link to clipboard
Copied
What happens when you run the script from Illustrator out?
Copy link to clipboard
Copied
ooooooh, I see now...appologies.
Copy link to clipboard
Copied
Please try this:
var Folder2Open = new Folder("~/Desktop/nik.1");
if(Folder2Open.exists) {
var myFolder = Folder2Open.selectDlg("Choose PDF output folder:");
} else {
alert ("Folder doesn't exist")
}
Copy link to clipboard
Copied
Still no joy I'm afraid, the 'Open' but is greyed out.
I hate to say it but it looks to be a mac related ADOBE issue.
Thanks for looking,
Nik
Find more inspiration, events, and resources on the new Adobe Community
Explore Now