Monday, November 08, 2010 at 12:02 AM.


on getFileData (path) {
	<<This script is called from the FATP file clicker script.
	local (flRunnable = false, flOdb = false, adrDest);
	local (pageSource = fatPages.readSourceFile (path));
	bundle { //fill in atts table
		if not fatPages.getPageAtts (@pageSource, @atts) {
			fatPages.noObjectError (path)};
		if not defined (atts.pageData) {
			fatPages.noObjectError (path)};
		atts.path = path};
	bundle { //is this a runnable desktop script?
		if string.lower (file.type (path)) == "ftds" {
			<<Desktop scripts are of type ftds.
			flRunnable = true};
		if defined (atts.runnable) and atts.runnable {
			flRunnable = true};
		if kb.cmdKey () {
			flRunnable = false}};
	if defined (atts.adrPageData) { //is this an odb object?
		flOdb = true};
	if (window.isOpen (path)) and (not flRunnable) and (not flOdb) {
		window.bringToFront (path);
		return (true)};
	if flOdb and !flRunnable { //if it's an odb object, confirm the destination adr
		adrDest = fatPages.confirmAddress (atts.adrPageData);
		if not adrDest {
			return (false)}};
	bundle { //move the data into a new file window or the odb
		if flOdb {
			if flRunnable { //no user confirmation
				adrDest = address (atts.adrPageData)};
			fatPages.unpackOdbObject (@atts, adrDest, path, flRunnable)}
		else {
			fatPages.unpackFileObject (@atts, path, flRunnable)}};
	return (true)}

This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.