home *** CD-ROM | disk | FTP | other *** search
- !!script
- // Copyright ⌐ 1997-1999 - Modelworks Software
- // @Modified build 260 cm19990128 - changed output to list the object type
-
- /**
- @Tool: dumpGlobals~lists all the global keys and values.
- @EndTool:
- @Summary: dumpGlobals~lists all the global keys and values
- */
-
- var gOutput = getOutput();
-
- function DoCommand()
- {
- gOutput.clear();
- var globalsMap = getGlobalMap();
- if (globalsMap)
- {
- gOutput.writeLine("Dumping Global Data");
- DumpStringMapFile(globalsMap);
- gOutput.writeLine("Finished Global Data");
- }
- }
-
- function DumpStringMapFile(map)
- {
- var list = newList();
- if (map)
- {
- var position = map.getHeadPosition();
- while (position && position.valid)
- {
- list.addTail(map.getNext(position));
- }
- }
- if (list.count)
- {
- list.sort(compareItems);
- var position = list.getHeadPosition();
- while (position && position.valid)
- {
- var association = list.getNext(position);
- if (association.value)
- {
- if (typeof(association.value) != "object")
- {
- gOutput.writeLine("Key \"" + association.key + "\" has a value of \"" + association.value + "\"");
- }
- else
- {
- gOutput.writeLine("Key \"" + association.key + "\" is a " + association.value.type + " object");
- }
- }
- else
- {
- gOutput.writeLine("Key \"" + association.key + "\" has a value of null");
- }
- }
- }
- }
-
- function compareItems(itemA, itemB)
- {
- // Assumes itemA and itemB are Association objects
- var itemApath = itemA.key.toLowerCase();
- var itemBpath = itemB.key.toLowerCase();
- if (itemApath < itemBpath)
- return -1;
- if (itemApath == itemBpath)
- return 0;
-
- return 1;
- }
-
- !!/script
-
-