AW: AW: How to detect a CD Drive / write permissions?

Tiemo Hollmann TB toolbook at kestner.de
Mon Dec 8 08:46:32 EST 2008


Thank you Ken for your detailed explanation, that will help!
Thanks
Tiemo

> -----Ursprüngliche Nachricht-----
> Von: use-revolution-bounces at lists.runrev.com [mailto:use-revolution-
> bounces at lists.runrev.com] Im Auftrag von Ken Ray
> Gesendet: Sonntag, 7. Dezember 2008 08:54
> An: Use Revolution List
> Betreff: Re: AW: How to detect a CD Drive / write permissions?
> 
> 
> > Mac and Win. Obviously there is no native Rev function, do you have
> snippets
> > how to ask the shell for it?
> 
> For Mac, you need to use the "system_profiler" shell command, pass it one
> of
> the data types you're interested in, and then parse the result. I'm not
> sure
> what Mac OSes you need to support, but here's the basics:
> 
> 1) Get a list of existing datatypes on the current machine so you can know
> which ones to check in subsequent commands:
> 
>     put shell("system_profiler -listDataTypes") into tTypesList
> 
> 2) You'll need to look at a handful of the data types. For example, my
> setup
> right now is a MacBook Pro with two external drives attached via USB and a
> built in R/W CD/DVD. On *my* machine, you query:
> 
>   - the "SPParallelATADataType" to get data on any mounted CD or DVD in
> the
> drive;
> 
>   - the "SPSerialATADataType" to get data on my internal hard drive;
> 
>   - and the "SPUSBDataType" to get data on the external hard drives.
> 
> The way you would call it is:
> 
>   put shell("system_profiler SPUSBDataType") into tUSBData
> 
> ... and then parse that. You can get a bunch of data types together, but
> it
> may make parsing difficult. But the way to do that is:
> 
>   put shell("system_profiler SPUSBDataType SPSerialATADataType") into
> tData
> 
> 3) You can get more info on this command by typing "man system_profiler"
> in
> the terminal on OS X.
> 
> As to Windows, there is a "driveType" property that you can query with a
> VBScript, but it uses the "Scripting.FileSystemObject" object, which may
> trigger virus protection software installed on the target machine. But if
> you want to use it, here's the VBScript:
> -------------
> Dim tFSO, tDrive, tType, tDrivePath
> 
> 'This is where you put in the drive letter you've parsed from a file path
> Set tDrivePath = "C:"
> 
> Set tFSO = CreateObject("Scripting.FileSystemObject")
> Set tDrive = tFSO.GetDrive( tDrivePath)
> Select Case tDrive.DriveType
>     Case 0: tType = "Unknown"
>     Case 1: tType = "Removable"
>     Case 2: tType = "Fixed"
>     Case 3: tType = "Network"
>     Case 4: tType = "CD-ROM"
>     Case 5: tType = "RAM Disk"
> End Select
> 
> ' If you're using Rev 3.0 or later, use this final line:
> result = tType
> 
> ' If you're using Rev 2.9 or earlier, use this line instead:
> WScript.Echo tType
> ----------------
> 
> There may be another way to run this without using the
> Scripting.FileSystemObject, but the only other way I've used is to wrap
> this
> code into a DLL, register the DLL and then call on the *DLL* from
> VBScript.
> 
> Anyway, hope this helps,
> 
> Ken Ray
> Sons of Thunder Software, Inc.
> Email: kray at sonsothunder.com
> Web Site: http://www.sonsothunder.com/
> 
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list