Copy link to clipboard
Copied
I want to set application preferences using Extendscript. I know it is done via ```app.preferences.setIntegerPreference(key, value)``` or Boolean or String etc.
The problem is, I do not know what the possible keys are. Is there a list of all the key values for the preferences? Or is there a way to get all of them?
Hello! I may have some helpful advice.
The preferences file is located in this location on Windows (C:\Users\YOU\AppData\Roaming\Adobe\Adobe Illustrator 26 Settings\en_US\x64\Adobe Illustrator Prefs) and in the libraries & application support folder on Mac.
You can open this file as text to see the various keys in there.
Using this example app.preferences.setIntegerPreference("plugin/PNGFileFormat/AntiAlias", 1); we can find the "AntiAlias" string in its proper block:
The location of this block
...Copy link to clipboard
Copied
Hello! I may have some helpful advice.
The preferences file is located in this location on Windows (C:\Users\YOU\AppData\Roaming\Adobe\Adobe Illustrator 26 Settings\en_US\x64\Adobe Illustrator Prefs) and in the libraries & application support folder on Mac.
You can open this file as text to see the various keys in there.
Using this example app.preferences.setIntegerPreference("plugin/PNGFileFormat/AntiAlias", 1); we can find the "AntiAlias" string in its proper block:
The location of this block is far down at line 1270 in my file, and these lines can change if one adds preferences that didn't exist before, etc.
At the very top, there's a 1st level {} brace block that starts with the word "plugin". The block with the PNG antialiasing is inside of that block, and the key-chain to get to the preference is "plugin/PNGFileFormat/AntiAlias".
So now you can experiment with app.preferences 'set' and 'get' to see if you can change these preferences. Get the new updated value right at the moment, and if that doesn't work, get updated values after restarting Illustrator.
I found out early on that mis-spelling or putting these keys out of order doesn't actually produce any errors, it simply adds a 'custom' preference to this file which was not there before. This could be useful if you wish to use the preferences mechanism to store some data which can persist between Ai sessions. As preferences can be migrated over to new versions with a Creative Cloud option, using this to store data may even provide longevity of your special custom preference living on after the app version change on a user's computer (without them having to do anything extra).
However, at the beginning stages I would caution against adding custom preferences and especially against naming them anything that is similar to what exists already, as this will get confusing. My number one problem was that when I tried to do my prefs, they were not working. They already can be not working for a number of reasons, but with my mucking about I have created a scenario where I'm extra not-sure why it's not working due to putting in a wrong key "plugin/PngFormat/AntiAlias". So now there were 2 entries and one was wrong altogether. Of course, I have done this a number of times wondering why it's not working, so by the time I fond where the Prefs file was and opened it, I had multiple entries which made no sense and I just started fresh on my next app updated.
Copy link to clipboard
Copied
Thanks!
Do you know why some of the preferences (e.g. the ones from the @femkeblanco 's list, like linkOptions or the path to an Additional plugin folder) are not featured there?
Copy link to clipboard
Copied
I found that entry in the pref's file's neighbor called "Adobe Illustrator Cloud Prefs" <-- open this file and there are additional preferences which I assume have more to do with cloud-things than desktop-things (?).
Copy link to clipboard
Copied
Yes, seems to be there! strange, it doesn't have much to do with cloud
Copy link to clipboard
Copied
This is a list of keys: https://github.com/ten-A/Extend_Script_experimentals/blob/master/preferencesKeeper.jsx
You can use preferences.getRealPreference(key), preferences.getBooleanPreference(key) or preferences.getIntegerPreference(key) to get the values.
Copy link to clipboard
Copied
Very useful. Do you know whether there is a similar list for the string preferences?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now