Read so much on the Drive. Functions that its making me ill.
What im trying to is simple but my error codes i can't figure out.
All it is:
1. Get a list of Drive on the computer
2. Get the type of Drives from the List of Drives, e.g( 5 == CD-ROM)
3. Check the type to see if Drive == 5 (CD-ROM)
4. If they are Type 5 then get the Display Name from the drive
5. If the Display name =="" no string Label then
6. Eject each of the Drive/s!
In over word check to see if each drive(CD-Rom) has a Disc
in it!
Here the code i've been working on:-
-----------------------------------------------------------------------
--Generate Drive List
GenerateDrivesL = Drive.Enumerate();
--Index Drive List
for i, DrivesList in GenerateDrivesL do
--Check Drive Type from list
WhichDrive = Drive.GetType(DrivesList);
-- See if drive type == 5 (CD-ROM Drives)
if WhichDrive == 5 then
--Check CD-ROM Drive Display name
Output = Drive.GetInformation(DrivesList).DisplayName;
--If the string is blank eject the drives!!
if Output == "" then
Drive.Eject(CDDVD);
end
end
-------------------------------------------------------------
my error displays:
Output = Drive.GetInformation(DrivesList).DisplayName;
is attempting to Index a Nil value!
Thanks in advance for looking at the code!
mdxafx
What im trying to is simple but my error codes i can't figure out.
All it is:
1. Get a list of Drive on the computer
2. Get the type of Drives from the List of Drives, e.g( 5 == CD-ROM)
3. Check the type to see if Drive == 5 (CD-ROM)
4. If they are Type 5 then get the Display Name from the drive
5. If the Display name =="" no string Label then
6. Eject each of the Drive/s!
In over word check to see if each drive(CD-Rom) has a Disc
in it!
Here the code i've been working on:-
-----------------------------------------------------------------------
--Generate Drive List
GenerateDrivesL = Drive.Enumerate();
--Index Drive List
for i, DrivesList in GenerateDrivesL do
--Check Drive Type from list
WhichDrive = Drive.GetType(DrivesList);
-- See if drive type == 5 (CD-ROM Drives)
if WhichDrive == 5 then
--Check CD-ROM Drive Display name
Output = Drive.GetInformation(DrivesList).DisplayName;
--If the string is blank eject the drives!!
if Output == "" then
Drive.Eject(CDDVD);
end
end
-------------------------------------------------------------
my error displays:
Output = Drive.GetInformation(DrivesList).DisplayName;
is attempting to Index a Nil value!
Thanks in advance for looking at the code!
mdxafx
Comment