Trying to obtain system Ram, using the following code below: I'm basing it on 
Javascript  code that does retrieve this... trying to make a coldfusion version 
of it.

The way I assumed it worked was that calling the memorys.Instances_ method 
would return a collection. At least it does with JScript in the form of an 
enumerator object.

And maybe it does if ( and only if ) there is an enumerator object present, and 
CF has structures etc not an enumerator object. In CF when I call 
memorys.instances_() I don’t seem to get much other than a single object…

Any ideas guys? 

COLDFUSION CODE:
=================
<cfobject action="create" 
type="com"
class="WbemScripting.SWbemLocator"
name="AX"
>
        
<cfdump var="#AX#">     
<cfset Memory = AX.ConnectServer()>

<cfdump var="#Memory#">
<cfset Memorys = Memory.Get("Win32_OperatingSystem")>

<cfdump var="#Memorys#">

<cfset imemory = Memorys.Instances_()>
<cfdump var="#imemory#">


JAVASCRIPT CODE:( what I'm basing the CF version on )...
=========================================================

var Locator = new ActiveXObject ("WbemScripting.SWbemLocator");
   var Memory = Locator.connectserver();
   var memoryerr = "0", TotalMessage = "", cr = "\r\n";
   
   try
      {
      var memorys = Memory.Get ("Win32_OperatingSystem");
      var imemory = new Enumerator (memorys.Instances_());
      }
   catch (error)
      {
      return ("Could not get memory info because: " + error.description);
      }

   for (;!imemory.atEnd();imemory.moveNext())
   {
      var memoryInstance = imemory.item();
          
          var TVM       = Math.round( 
(memoryInstance.TotalVisibleMemorySize/1024) );
          var FPM       = Math.round( (memoryInstance.FreePhysicalMemory/1024) 
);
          var TVMS      = Math.round( 
(memoryInstance.TotalVirtualMemorySize/1024) );
          var FVM       = Math.round( (memoryInstance.FreeVirtualMemory/1024) );

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Community/message.cfm/messageid:222474
Subscription: http://www.houseoffusion.com/groups/CF-Community/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.5

Reply via email to