drummerSupport
drummerSupport copied to clipboard
"Big Includes" outline
I was talking with a developer yesterday and the question came up, what about huge outlines? How does OPML handle those? That gave me a chance to tell the story about how i'm archiving Scripting News, and how "include" nodes work.
I'm writing this up now on Scripting News. In the meantime, here's the source of the Drummer script that builds the demo outline. It's the first time I've written this kind of script in Drummer, it's the kind of thing I'd do routinely in Frontier.
I ran it from the Scripts menu with a "scratchpad" outline in the frontmost tab. The outline it produces works! ;-)
function settype (theType) {
op.attributes.setOne ("type", theType);
}
function getmonthurl (theMonth) {
theMonth = new Date (theMonth); //make sure it's a date not a string
const y = theMonth.getFullYear ();
const m = string.padWithZeros (theMonth.getMonth () + 1, 2);
return ("http://scripting.com/misc/opmlForInclusion/" + y + "/" + m + ".opml");
}
function addinclude (monthname, yearnum, dir, when) {
op.insert (monthname, dir);
settype ("include");
op.attributes.setOne ("url", getmonthurl (monthname + " " + yearnum));
}
op.insert ("Big Includes outline", down)
settype ("outline");
function addyear (yearnum) {
op.insert (yearnum, right);
addinclude ("January", yearnum, right);
addinclude ("February", yearnum, down);
addinclude ("March", yearnum, down);
addinclude ("April", yearnum, down);
addinclude ("May", yearnum, down);
addinclude ("June", yearnum, down);
addinclude ("July", yearnum, down);
addinclude ("August", yearnum, down);
addinclude ("September", yearnum, down);
addinclude ("October", yearnum, down);
addinclude ("November", yearnum, down);
addinclude ("December", yearnum, down);
op.go (left, 2);
op.collapse ();
}
addyear (2020);
addyear (2019);
addyear (2018);