Preferences File

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

Where is the AE preferences file? Is it something you can open up in a text editor and modify or is it embedded somewhere? I want to use the preferences to store some things but I want to be able to see what I'm doing.
User avatar
Disciple
Posts: 137
Joined: June 5th, 2004, 8:05 am
Location: Los Angeles, CA
Contact:

On the mac, the prefs file is stored with your user preferences. It is a text file that can be 'easily' edited.

Impudent has a script here called "SamplerSizeRadio" that writes to the prefs file. You might want to check it out.

HTH

Alex
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

What about on a PC?
Impudent1
Posts: 57
Joined: June 12th, 2004, 6:40 pm

If you take a look at the Reduce OpenGL Texture Size.jsx included with 6.5 in the protected folder you will see the base syntax for how to set a pref.

savePrefAsLong(String section_name, String key_name, int value)
savePrefAsFloat(String section_name, String key_name, float value)
savePrefAsString(String section_name, String key_name, String value)
savePrefAsBool(String section_name, String key_name, bool value)

as well as get should all be valid.

the base path on windows assuming you have installed to C:\ will be in the users documents application data

C:\Documents and Settings\USERNAME\Application Data\Adobe\After Effects\Prefs
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

This might be useful as reference, some lines I've pulled out of a script that stores and retrieves user defined prefs.

// this bit checks to see if pref already exists
var userName = ""
if (app.settings.haveSetting("FilmToQuicktime_prefs", "UserName")) {
userName = app.settings.getSetting("FilmToQuicktime_prefs", "UserName");
}

// this was used to create some editable text in a dialog
var newUserName = my_dialog.add("edittext", [100, 140, 250, 160], userName);
newUserName.onChange = on_userName_changed;

// this is the function called if the newUserName text is changed
function on_userName_changed() {
userName = this.text;
app.settings.saveSetting("FilmToQuicktime_prefs", "UserName", userName);
}
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

Paul, I'm referencing this thread to set some preferences but I'm having trouble. I need to store the location of a file so that the user does not need to find it each time they run the script. The script involves importing an AE project. Here's my code for the file and preference stuff:

Code: Select all

var fileLoc = ""
if (app.settings.haveSetting("SpeedLostDriveIn_prefs", "FileLocation")) {
fileLoc = app.settings.getSetting("SpeedLostDriveIn_prefs", "FileLocation");
} 

var items = app.project.items; 

if(fileLoc){
	theFile = fileLoc;
}else{
	var findIt = fileGetDialog("Import Items from Folder...", "");

	var theFile = findIt
}


if (app.settings.haveSetting("SpeedLostDriveIn_prefs", "FileLocation")) {
	alert("In savesetting");
	app.settings.saveSetting("SpeedLostDriveIn_prefs", "FileLocation", theFile.toString());
}else{
	app.preferences.savePrefAsString("SpeedLostDriveIn_prefs", "FileLocation", theFile.toString());
	alert("In savePrefsAsLong, and string is " + theFile.toString());

}
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

The reason it's not saving the pref is the line towards the end where you've used app.preferences.savePrefAsString instead of app.settings.saveSetting.

The former is one of a set of undocumented functions for accessing AE's built-in preferences, while the latter is for creating/accessing your own user-defined prefs, which is what you're trying to do here. It looks like you thought this was the way to initialise a new pref, but you just do that using saveSetting.
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

Thanks Paul.
Post Reply