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

system.verbs.builtins.fileMenu.openGuestDatabase

on openGuestDatabase (f, topLevelName="", flHidden=true) {
	<<Changes
		<<1/13/01; 9:21:46 AM by DW
			<<Created. Foolproof way to open a guest database, or create it if it doesn't exist. 
			<<topLevelName is a string, providing the name of the top level item in the database. If it's empty, don't create a top-level item.
			<<If the file is already open, ignore flHidden. If we have to create a new file, pass it down to fileMenu.new.
			<<Return true if the file is open, false if we were unable to open or create it.
			<<http://docserver.userland.com/fileMenu/openGuestDatabase
		<<1/13/01; 5:55:05 PM by DW
			<<When opening a file respect the flHidden param.
	file.sureFilePath (f);
	if file.exists (f) {
		if window.isOpen (f) {
			return (true)};
		try {
			fileMenu.open (f, flHidden);
			return (true)}};
	fileMenu.new (f, hidden:flHidden);
	window.setPosition (f, 30, 40);
	window.setSize (f, 350, 400);
	if topLevelName != "" {
		new (tabletype, @[f].[topLevelName]);
		try {delete (@[f].["item #1"])};
		local (oldtarget = target.set (@[f]));
		wp.settextmode (false);
		target.set (oldtarget)};
	fileMenu.save (f);
	return (true)}
<<bundle //test code
	<<openGuestDatabase ("c:\\program files\\radio userland\\backups\\test.root", "testStuff", false)



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.