<klip>
   <identity>
      <title>
         API: File
      </title>
   </identity>
   <locations>
      <icon>
         http://www.klipfolio.com/static/klips/klipfolio/sample_icon.png
      </icon>
      <banner>
         http://www.klipfolio.com/static/klips/klipfolio/sample_banner.png   
      </banner>
   </locations>
   <setup>
      <scriptmode>
         extended
      </scriptmode>
   </setup>
   <style>
      alert {
         type: item;
      }

      sender {
         itemcol: 2;
         noterow: 1;

         label: 'Sender';

         emphasis: strong;
      }


      summary {
         itemcol: 3;
         noterow: 4;

         wrap: false;

         notelabel: false;
      }

      date {
         itemcol: 4;
         noterow: 2;

         label: 'Date';
      }

      category {
         noterow: 3;

         label: 'Category';
      }


      level {
         itemcol: 1;
         noterow: 5;
         notelabel: false;
         
         type: image;
      }

      url {
         type: link;
      }
            
      id {
         key: override;
      }

   </style>
   <klipscript>
   <![CDATA[

      
     // Place the contents of 
     // 	
     // 	http://support.klipfolio.com/files/demo/demo.xml
     // at
     // 
     // 	c:\temp\test.xml
     // 
     // and reload this Klip.
      	
function onRefresh ()
{	
	var path = "c:\\temp\\test.xml";	// UNC path to file
	
	var F, data;	

	F = Engines.File.open (path);	
	if (!F.exists)				// Check if file exists
	{
		_t( "File not found: " + path );
		return false;
	}
	
	show_file_properties( F )
	if (data = F.read ()) 		// Read contents of file
	{
		return Engines.Data.process( data );
	} 

	//
	// Why no F.close()?
	//
	// Klipfolio Dashboard never keeps a file open.  The calls to File.open()
	// and File.read() both open and close the file within the function call.
	//
	// So on exit, the file has already been closed by the last File.read().
	//
}

function show_file_properties( F )
{
	_t( "             name: " + F.name );
	_t( "             path: " + F.path );
	_t( "           exists: " + F.exists );
	_t( "             size: " + F.size );
	_t( "     lastmodified: " + F.lastmodified );
	_t( "       lastaccess: " + F.lastaccess );
	_t( "         creation: " + F.creation );
	_t( "       attributes: " + F.attributes );
	_t( "         readonly: " + F.readonly );
	_t( "           system: " + F.system );
	_t( "          archive: " + F.archive );
	_t( "           device: " + F.device );
	_t( "           normal: " + F.normal );
	_t( "        temporary: " + F.temporary );
	_t( "       sparsefile: " + F.sparsefile );
	_t( "     reparsepoint: " + F.reparsepoint );
	_t( "       compressed: " + F.compressed );
	_t( "          offline: " + F.offline );
	_t( "notcontentindexed: " + F.notcontentindexed );
	_t( "        encrypted: " + F.encrypted );
}

function _t(s) 
{
	trace( s + "\r\n" );
}

]]>
	</klipscript>
</klip>

