Page 1 of 1

Preferences File

Posted: September 18th, 2004, 7:59 pm
by byronnash
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.

Posted: September 19th, 2004, 12:52 pm
by Disciple
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

Posted: September 19th, 2004, 4:09 pm
by byronnash
What about on a PC?

Posted: September 23rd, 2004, 11:38 pm
by Impudent1
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

Posted: September 26th, 2004, 4:05 pm
by Paul Tuersley
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);
}

Posted: November 22nd, 2005, 2:06 pm
by byronnash
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());

}

Posted: November 23rd, 2005, 3:22 pm
by Paul Tuersley
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.

Posted: November 28th, 2005, 6:34 am
by byronnash
Thanks Paul.