My startup script for boards looks like:
menu 'Layers {\
Top : display NONE top torigins tKeepout tRestrict borigins pads vias dimension unrouted; | \
Bottom : display NONE bottom borigins bKeepout bRestrict torigins pads vias dimension unrouted; | \
All : display top bottom pads vias dimension unrouted tplace \
torigins tnames tvalues bnames bvalues trestrict bplace borigins brestrict Document ?? Edit_history; | \
NoNames : display -tnames -tvalues -bnames -bvalues; | \
noDocu : display -tdocu -bdocu; | \
AddDocu: display tdocu bdocu Document ?? Documentation History To-Do; | \
SilkScreen: run display-silk; \
}' \
'TogScreen : run toglays 21 22 25 26 27 28 51 52;' \
'DrawOn {\
Top : change layer top; | \
Bottom : change layer bottom; | \
tPlace : change layer tPlace; | \
Dim : change layer Dimension; | \
History: change layer History; \
}' \
'Grid {\
Toggle : run gridhalf 1 t ; info | \
Smaller : run gridhalf 0.5; move | \
Bigger : run gridhalf 2; move | \
OnOff : grid; move \
}' \
'Circle : run circle;' \
'Count : run count;' \
'DrlAid : run drill-aid;' \
'RipPoly : ripup @;' \
;
The "run" commands are EAGLE "User Language Programs", which are sort-of like scripts (the "act" by generating script text), but they look like C code, and they can access the board/etc internal data structures, throw up user menus, read files, and stuff like that.
You might especially note the syntax: AddDocu: display tdocu bdocu Document ?? Documentation History To-Do;
Which says "display the Documentation. History, and To-Do layers IFF they exist. If they don't exist, don't bother complaining. You could put the same thing on a hotkey, and it might save you from having to edit your .scr files all the time.
One of my favorites is that "gridhalf" ULP, which looks like:#usage "<qt><b>gridhalf.ulp <mult> m|i|t"
"<p>Multiply the current grid setting by a factor."
"<p>"
"<author>Author: Bill Westfield (westfw)</author></qt>"
real griddistance;
real multiplier = 1.0;
string cmd = "";
string units;
string newgrid;
UL_GRID oldgrid;
char arg2;
string gu2str (int unittype)
{
switch (unittype) {
case GRID_UNIT_MIC:
return " mic";
case GRID_UNIT_MM:
return " mm";
case GRID_UNIT_MIL:
return " mil";
case GRID_UNIT_INCH:
return " inch";
}
}
if (board) board(B) {
oldgrid = B.grid;
} else if (library) library(L) {
oldgrid = L.grid;
}
if (argc > 0) {
if (argc > 2) {
if (oldgrid.unit == GRID_UNIT_INCH) {
newgrid = "grid mm;";
} else {
newgrid = "grid inch;";
}
} else newgrid = "";
multiplier = strtod(argv[1]);
griddistance = oldgrid.distance * multiplier;
if (oldgrid.unit == oldgrid.unitdist) {
/*
* original units still being used. No conversion necessary!
*/
sprintf(cmd, "grid %f;%s\n", griddistance, newgrid);
exit(cmd);
} else {
/*
* We have to play with units. We could convert, but let's
* switch the commands around instead (gives us compatibility
* with the menus, hopefully!)
*/
sprintf(cmd, "grid %s; grid %f; grid %s;%s\n", gu2str(oldgrid.unitdist),
griddistance, gu2str(oldgrid.unit), newgrid);
exit(cmd);
}
}