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

choose folder default location

Guest
Oct 05, 2012 Oct 05, 2012

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

TOPICS
Scripting
5.4K
Translate
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
Adobe
Community Expert ,
Oct 05, 2012 Oct 05, 2012

it works fine in Windows

Translate
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
Guest
Oct 05, 2012 Oct 05, 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

Translate
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 ,
Oct 05, 2012 Oct 05, 2012

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:");

Translate
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
Guest
Oct 05, 2012 Oct 05, 2012

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!!!

Screen shot 2012-10-05 at 17.51.14.jpg

The below image is how I was expecting it to work

Screen shot 2012-10-05 at 17.57.42.jpg

Thanks,

Nik

Translate
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 ,
Oct 05, 2012 Oct 05, 2012

bummer, lets see what Mark the Legend has to say about this mac nonsense

Translate
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
Guest
Oct 05, 2012 Oct 05, 2012

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!

Translate
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 ,
Oct 05, 2012 Oct 05, 2012

mac vs pc Round 1 - choose a default folder

  • macs are pretty
  • pcs work
Translate
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
Guest
Oct 05, 2012 Oct 05, 2012

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

Translate
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 ,
Oct 05, 2012 Oct 05, 2012

1,400 post!!! yey!!

1400posts.gif

ok, I let you win this "battle" for now ...

Translate
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
Guru ,
Oct 05, 2012 Oct 05, 2012

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

Translate
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 ,
Oct 05, 2012 Oct 05, 2012

what's on October 5th Mark? some British holiday?

Translate
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
Guru ,
Oct 05, 2012 Oct 05, 2012

Tut tut… don't you start that tone Carlos…

http://www.apple.com/

The 7th is my birthday… 4 and a half…

Translate
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
Guest
Oct 05, 2012 Oct 05, 2012

smiley_mac.jpg

Translate
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
Guru ,
Oct 05, 2012 Oct 05, 2012

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…

Translate
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
Guest
Oct 05, 2012 Oct 05, 2012

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

Translate
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
Guest
Oct 05, 2012 Oct 05, 2012

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:");

Translate
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 ,
Oct 05, 2012 Oct 05, 2012
LATEST

What happens when you run the script from Illustrator out?

Translate
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 ,
Oct 05, 2012 Oct 05, 2012

ooooooh, I see now...appologies.

Translate
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 ,
Oct 05, 2012 Oct 05, 2012

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")

        }

Translate
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
Guest
Oct 05, 2012 Oct 05, 2012

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

Translate
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