home *** CD-ROM | disk | FTP | other *** search
/ com!online 2002 July / com!online0702.iso / software / livemotion / DATA1.CAB / Scripting_Resources / Samples / Automation_Scripts / DumpProperties.js < prev    next >
Encoding:
Text File  |  2002-05-13  |  2.1 KB  |  83 lines

  1. /***************************************************************
  2. ADOBE SYSTEMS INCORPORATED 
  3. Copyright 2001 Adobe Systems Incorporated 
  4. All Rights Reserved 
  5.  
  6. NOTICE:  Adobe permits you to use, modify, and distribute this 
  7. file in accordance with the terms of the Adobe license agreement 
  8. accompanying it.  If you have received this file from a source 
  9. other than Adobe, then your use, modification, or distribution
  10. of it requires the prior written permission of Adobe. 
  11. ***************************************************************/
  12. /***************************************************************
  13. Author: Mary Obelnicki
  14. ***************************************************************/
  15.  
  16. /***************************************************************
  17. Description goes here
  18.  
  19. ***************************************************************/
  20.  
  21. /***************************************************************
  22. To change the behavior of this script, 
  23. make your changes below
  24. ***************************************************************/
  25.  
  26. DumpProperties(this);
  27.  
  28. /***************************************************************
  29. DO NOT EDIT BELOW THIS LINE
  30. ***************************************************************/
  31.  
  32.  
  33.  
  34. function DumpProperties(anObject)
  35. {
  36.         var ret = "\r\n";
  37.  
  38.         ret += anObject + " typeof: " + typeof(anObject) + "\r\n";
  39.         ret += DumpContainedProperties(1, anObject);
  40.  
  41.         return ret;
  42. }
  43.  
  44. function DumpContainedProperties(indentLevel, anObject)
  45. {
  46.     var ret = "";
  47.     for (aProperty in anObject)
  48.     {
  49.         var i=0;
  50.         while (i < indentLevel)
  51.         {
  52.             ret += "    ";
  53.             ++i;
  54.         }
  55.  
  56.         ret += aProperty;
  57.  
  58.         var typeName = typeof(anObject[aProperty]);
  59.         ret += " (typeof: " + typeof(anObject[aProperty]) + ")";
  60.         if (typeName != "function")
  61.         {
  62.             ret += ": ";
  63.  
  64.             try
  65.             {
  66.                 ret += anObject[aProperty];
  67.             }
  68.             catch (theError)
  69.             {
  70.                 ret += "<no toString defined>";
  71.             }
  72.         }
  73.  
  74.         ret += "\r\n";
  75.  
  76.         if (typeName == "object")
  77.         {
  78.             ret += DumpContainedProperties(indentLevel+1, anObject[aProperty]);
  79.         }
  80.     }
  81.  
  82.     return ret;
  83. }