Skip to main content
Inspiring
June 22, 2019
Question

• "Package" (from 'File' menu)  ->   Possible to get the path chosen by user?

  • June 22, 2019
  • 2 replies
  • 1310 views

Hello -

I was wondering if it was possible to get the path chosen by the user

when this last click on "PACKAGE" (from the "FILE" menu)?

If so, how please, can I get it?

Thank you (again)

Enjoy your day, all of you  🙂

- Dimitri

This topic has been closed for replies.

2 replies

Inspiring
June 24, 2019

Hi Silly-V -

We are still using the "CC 22.1" (at work).

I followed the below "way to do" to find the prefs. folder:

Mac OS X

In Mac OS X, open Finder and press Shift-Cmd-G. Type ~/Library/Application Support in the dialog box, and click Go. IMPORTANT: The value you type in the dialog box begins with a tilde (~). It's the Library hidden in your Home folder that you need to access, not the main Mac Library.

Except if I may be blind, I don't see/find anything like "Adobe Illustrator Prefs".

I'll still look at it when I come back home…

Regards,

- Dimitri

Silly-V
Legend
June 24, 2019

The screenshot folder looks to be the wrong location, I'll be able to find this out later if still needed.

Inspiring
June 24, 2019

It's the one from the user, no?…

/Users/studio_00/Library/Application Support/Adobe

CarlosCanto
Community Expert
Community Expert
June 22, 2019

I didn't find anything we can use.

Silly-V
Legend
June 23, 2019

I checked out the Preferences and here's what I found in the file "C:\Users\{NAME}\AppData\Roaming\Adobe\Adobe Illustrator 23 Settings\en_US\x64\Adobe Illustrator Prefs":

/Packagepreference {

/relinkLinks 0

/generateReport 1

/collectLinksInSeparateFolder 0

/collectLinks 0

/collectFonts 1

/SourceFolder [ 24

433a5c55736572735c566173696c795c4465736b746f705c

]

}

The file is updated when Illustrator shuts down though, but you can get the latest run-time version of this preference string, which is the folder path the user chooses via code:

var pref = app.preferences.getStringPreference("plugin/Packagepreference/SourceFolder");

alert(pref);

Setting this via code is like so:

app.preferences.setStringPreference("plugin/Packagepreference/SourceFolder", "C:\\Users\\You\\Desktop\\SubFolder");

*Edit: My example first said "~/Desktop/SubFolder", but I'm not sure "~/Desktop" syntax works with this, as it recorded the tilde and I'm not sure whatever reads it would read it the way scripting does. Also, probably on Windows the backslashes are mandatory, so I changed all / to \\.

When the user clicks the Package menu command, sure enough the produced dialog box reflects the updated folder path as the one auto-displayed. If this folder does not exist, as in the case of my folder "SubFolder", clicking the folder icon starts the folder-browse dialog all the way back at the "My Computer" on Windows.

Inspiring
June 24, 2019

Hey Silly-V -

That sounds great... Will definitely play around with it.

I'm already back, since I get this error:

#target Illustrator

#targetengine main

var myDoc     = app.activeDocument;

app.executeMenuCommand('Package Menu Item');            // Make a "PACKAGE" of the open file

var pref = app.preferences.getStringPreference("plugin/Packagepreference/SourceFolder");

    alert (pref);

Thank you,

- Dimitri