DiskSize

Ken Ray kray at sonsothunder.com
Tue Jun 17 16:36:01 EDT 2003


Dan,

Can I assume you mean on Mac? Because in Windows you can check to see if
the drive letter is A: or B:. On the Mac, you can use appleScript to
determine if the "ejectable" of the disk is true, and then check the
capacity of the disk to see if it is under 2MB. I don't have a floppy
drive on my G4, but here's some code you can work with:

tell application "Finder"
  set tDisk to (every disk whose ejectable is true)
  -- And then grab the first item
  if the capacity of tDisk is less than 2000000 then
    -- do something
  end if
end tell

This won't tell you if it's a floppy disk per se, but it's close. You
could probably AppleScript the Apple System Profiler, but that would
mean launching an app (which you probably wouldn't want to do).

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/ 

> -----Original Message-----
> From: use-revolution-admin at lists.runrev.com 
> [mailto:use-revolution-admin at lists.runrev.com] On Behalf Of 
> Dan Friedman
> Sent: Tuesday, June 17, 2003 11:01 AM
> To: RunRev Mail List
> Subject: DiskSize
> 
> 
> Greetings...
> 
> The Goal:  To determine if the user is opening a file from a 
> floppy disk.
> 
> Proposed Solution:  The only thing I can think to do this is 
> to use the capacity of the disk.  If it's less than 2MB, I 
> can assume it's a floppy. Do you agree?
> 
> Now, there is no diskSize function that I know of, so I have 
> to write it myself.  I'll have to add the size of every file 
> on the disk, plus the diskSpace, to get the size of the volume.
> 
> Question:  Can you think of a better way?  If not, has anyone 
> got a code snippet to do this?
> 
> Thanks in advance,
>  -Dan
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com 
> http://lists.runrev.com/mailman/listinfo/use-> revolution
> 





More information about the use-livecode mailing list