Ok, I've gotten this to a presentable state. I like the interface and the overall minial space it takes up. The listBox option you used eventually gave me an idea. So the new setup is this...
WARNING!!!! If you do run this script, it must be in the "ScriptsUI Panels" folder and launched from "Window" menu. I made this on mac, so it may not work on pc. Not sure though, I have no PC.
Code: Select all
{
alert("WARNING!!!!!!\n" +
"\n" +
"Make sure this script is in your \"ScriptUI Panels\" folder and you run it from the \"Window\" menu!\n" +
"\n" +
"If you goofed and you didn't do the above, just hit cancel on the next screen, put things where they should be and relaunch script.\n" +
"\n" +
"Shortcut pref file default locations are:\n" +
"\n" +
"Mac = Users > \"username\" > Library > Preferences > Adobe > After Effects > 8.0\n" +
"\n" +
"Pc = C > Documents and Settings > \"username\" > Application Data > Adobe > After Effects > 8.0\n" +
"\n")
}
{
// aeKeysSetup Object
function aeKeysSetup(thisObj)
{
var aeKeysData = new Object();
aeKeysData.scriptName = "Shortcut Keys";
aeKeysData.version = ".70";
aeKeysData.strHelp = "?";
aeKeysData.strAbout = "About AE Shortcut Keys\n" +
"\n" +
"Assembled by: David Torno\n" +
"March, 2008\n" +
"\n" +
"This script hopefully will be updated at some point soon to what I really wanted it to look like, but it serves it's purpose for now. I hope you find it useful\n" +
"\n" +
"Additional resource's, help and inspiration by...\n" +
"-EXTRA EXTRA EXTRA thanks to Paul Tuersley, he truely is the man!\n" +
"-redefinery.com - Lloyd Alvarez\n" +
"-aescripts.com\n" +
"-aenhancers.com\n" +
"-Dan Ebberts and motionscript.com\n" +
"-The world Wide Web and various books which helped make my brain turn to mush, which then resulted in me sort of understanding this Javascript thingy\n" ;
// Build the interface
function aeKeysSetup_buildUI(thisObj)
{
var pal = (thisObj instanceof Panel) ? thisObj : new Window("palette", "Shortcut Keys Reference", myFile, {resizeable:true});
if (pal != null) {
// Open file and read contents (hopefully).
var myFile = fileGetDialog("Find the file","");
if (myFile !=null){
// open file
var fileOk = myFile.open("r", "TEXT", "????");
if (fileOk){
for (var a = 1; a <= 204; ++a) {
myFile.readln();
}
var textArray = new Array();
while (!myFile.eof){
textArray[textArray.length] = myFile.readln();
}
// close file before exiting
myFile.close();
var res =
"group { \
orientation:'row', alignment:['left', 'fill'], spacing:5, \
dropDownList: DropDownList {alignment:['fill','fill'] }, \
aboutbutton: Group { \
alignment:['left','top'], alignChildren:['left','top'], \
help: Button { text:'" + aeKeysData.strHelp + "', alignment:['left','top']}, \
},\
}";
pal.margins = [10,10,10,10];
pal.grp = pal.add(res);
// Workaround to ensure the edittext text color is black, even at darker UI brightness levels
var winGfx = pal.graphics;
var darkColorBrush = winGfx.newPen(winGfx.BrushType.SOLID_COLOR, [0,0,0], 1);
pal.grp.dropDownList.graphics.foregroundColor = darkColorBrush;
for (var x = 0; x < textArray.length; ++x) {
pal.grp.dropDownList.add("item", textArray[x]);
}
pal.grp.dropDownList.preferredSize.height = 10;
pal.grp.dropDownList.selection = 0;
pal.grp.aboutbutton.help.onClick = function () {alert(aeKeysData.strAbout, aeKeysData.strAboutTitle);}
pal.layout.layout(true);
pal.grp.minimumSize = pal.grp.size;
pal.layout.resize();
pal.onResizing = pal.onResize = function () {this.layout.resize();}
return pal;
}
}
}
}
var aeKeysPal = aeKeysSetup_buildUI(thisObj);
if ((aeKeysPal != null) && (aeKeysPal instanceof Window)) {
aeKeysPal.center();
aeKeysPal.show();
}
}
aeKeysSetup(this);
}
It's totally dockable, takes up very little space, loads the text correctly. The only hang up is that if you do dock it, and then close AE, you are prompted to locate the file when you start AE again. So my next question is, how do I get this to point to the file automatically or at least have the user write it in the script once and it just loads. I've tried writing an absolute path to the file using variations of File.absoluteURI, relativeURI, file.open, eval, but have had no success. The Javascript Tools PDF is informative and not all at the same time. I am catching on quick though.
