Bloody Hell Steve....

I have been looking at that example from Ben's for hours and I didn't notice
the IsReady() check..


:-( 

Cheers



-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Steve Onnis
Sent: Saturday, 12 April 2008 9:57 PM
To: [email protected]
Subject: [cfaussie] Re: Coldfusion and .Net


Well it wasn't totally useless information.  Depending on if the drive is
ready and they type of drive some methods are either not available or can
not be performed on the drive.
 
Hope this helps you
 
<cfobject type=".NET" name="sidiClass" class="System.IO.DriveInfo">

 <!--- Get drives --->

<cfset drives=sidiClass.GetDrives()>

<cfoutput>
<table border="1" cellpadding="2" cellspacing="0" >
        <tr>
                <th>Drive</th>
                <th>Drive Type</th>
                <th>Drive Capacity</th>
                <th>Drive Space Used</th>
                <th>Drive Free Space</th>
        </tr>
        <cfloop from="1" to="#ArrayLen(drives)#" index="Count">
        <tr>
                <td>#drives[Count].Get_Name()# (<cfif
drives[Count].Get_IsReady()>#drives[Count].Get_VolumeLabel()#</cfif>)</td>
                <td>#drives[Count].Get_DriveType().ToString()#</td>
                <td>
                        <cfif drives[Count].Get_DriveType().ToString() EQ
"CDRom" OR
        
drives[Count].Get_DriveType().ToString() EQ "Removable">
                                <cfif drives[Count].Get_IsReady()>
                                        #Round(drives[Count].Get_TotalSize()
/ 1024 / 1024 / 1024)#
                                <cfelse>
                                        0
                                </cfif>
                        <cfelse>
                                #Round(drives[Count].Get_TotalSize() / 1024
/ 1024 / 1024)# Gig
                        </cfif>
                </td>
                
                <td>
                        <cfif drives[Count].Get_DriveType().ToString() EQ
"CDRom" OR
        
drives[Count].Get_DriveType().ToString() EQ "Removable">
                                <cfif drives[Count].Get_IsReady()>
        
#Round((drives[Count].Get_TotalSize() -
drives[Count].Get_AvailableFreeSpace()) / 1024 / 1024 / 1024)# Gig
                                <cfelse>
                                        0
                                </cfif>
                        <cfelse>
                                #Round((drives[Count].Get_TotalSize() -
drives[Count].Get_AvailableFreeSpace()) / 1024 / 1024 / 1024)# Gig
                        </cfif>
                </td>
                <td>
                        <cfif drives[Count].Get_DriveType().ToString() EQ
"CDRom" OR
        
drives[Count].Get_DriveType().ToString() EQ "Removable">
                                <cfif drives[Count].Get_IsReady()>
        
#Round((drives[Count].Get_AvailableFreeSpace()) / 1024 / 1024)# Gig
                                <cfelse>
                                        0
                                </cfif>
                        <cfelse>
        
#Round((drives[Count].Get_AvailableFreeSpace()) / 1024 / 1024 / 1024)# Gig
                        </cfif>
                        
                </td>
        </tr>
        </cfloop>
</table>
</cfoutput>


Steve 
 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of CyberAngel
Sent: Saturday, 12 April 2008 8:48 PM
To: [email protected]
Subject: [cfaussie] Coldfusion and .Net



Anyone know if there is any tricks to doing this? Is it a type cast problem
or something else?

 

I have some Ben Forta code one works and the other errors.

 

First Code:  Error's

 

<cfobject type=".NET" name="sidiClass" class="System.IO.DriveInfo">

 <!--- Get drives --->

<cfset drives=sidiClass.GetDrives()>

 

<cfloop from="1" to="#ArrayLen(drives)#" index="Count">

      <cfoutput>#drives[Count].Get_Name()# -
#drives[Count].Get_AvailableFreeSpace()#</cfoutput><br>

</cfloop>

 

The error is this

 

drives[Count].Get_AvailableFreeSpace()

 

and produces this error

 

The web site you are accessing has experienced an unexpected error.
Please contact the website administrator.

 

With nothing useful.

 

Yet Ben Forta's Code with this works

 

<cfset QuerySetCell(result, "freespace",
drives[i].Get_AvailableFreeSpace())>

 









--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to