PDA

View Full Version : Finding which drive contains a CD from "CD Volume Label"


KennyC
03-22-2004, 01:49 PM
Hi,

I'm trying to do a menu that will search the hardware devices located on your PC by looking for a specific CD Volume Label.

I'm no programmer so using VB or similar isn't really an option for me.

What I want to do is:
==============
1. Look at all device letters from C: to Z: (I don't know what device letter someone may have the CD in)
2. Find the device letter the CD is in by searching for a specific CD Volume Label
3. Using the device letter from 2. above, then copy the contents of that CD to the hard-drive, say C:\CD1

You see, some of us have a collection of archived articles on a 6 CD set and I'm trying to create a menu that will enable any of us with a DVD-R/RW, to copy the contents of each CD to hard-drive, then create a DVD.iso that can be easily burnt to a blank DVD, some are computer illiterate. (I can create a command-line to create the DVD.iso so that's no problem)

Hope it's not too complicated. :oops

Cheerz:) ;) :lol

Worm
03-22-2004, 02:56 PM
--Populate a table with A-Z
tblDriveLetters = {};
for n=65, 90 do
Table.Insert(tblDriveLetters, Table.Count(tblDriveLetters) + 1, String.Char(n))
end

--Check to see which drives are a CD
strCD="";
for n, DriveLetter in tblDriveLetters do
if String.ToNumber(Drive.GetType(DriveLetter)) == 5 then
strCD= strCD .. DriveLetter .. "\r\n";
end
end
Dialog.Message("CD Drives", "The CD drives available on your system are as follows: \r\n" ..strCD, MB_OK)

KennyC
03-22-2004, 03:52 PM
Originally posted by Worm

--Populate a table with A-Z
tblDriveLetters = {};
for n=65, 90 do
Table.Insert(tblDriveLetters, Table.Count(tblDriveLetters) + 1, String.Char(n))
end

--Check to see which drives are a CD
strCD="";
for n, DriveLetter in tblDriveLetters do
if String.ToNumber(Drive.GetType(DriveLetter)) == 5 then
strCD= strCD .. DriveLetter .. "\r\n";
end
end
Dialog.Message("CD Drives", "The CD drives available on your system are as follows: \r\n" ..strCD, MB_OK)


Hi worm,

Thankz for replying, appreciated.

It returns G, H, and L which is correct for my PC.

But how can I search for the CD Volume Label string of say CD1, or CD2 etc. then pass this onto another command/function that will copy the contents of that CD to a specific directory on your hard-drive.

e.g. if CD Volume Label = CD1, it copies CD contents to C:\CD1 etc.

Cheerz:) ;) :D

Worm
03-22-2004, 05:12 PM
Here's a sample app that uses a DLL I wrote to grab the Volume Label.

Enjoy!

Worm
03-22-2004, 05:15 PM
As for copying a folder.
See this thread. (http://www.indigorose.com/forums/showthread.php?s=&threadid=6797&highlight=copy+folder)

KennyC
03-23-2004, 04:55 AM
Originally posted by Worm
Here's a sample app that uses a DLL I wrote to grab the Volume Label.

Enjoy!

Hi Worm,

I'm really sorry about this, just can't seem to get it working.

I can find the device letter and the Volume Label, but don't know where to go from there, how to pass this information on.

Like I said, I'm no programmer. :oops :oops

Hope you have the patience to guide me through this me being a nuisance :oops

Cheerz:) ;) :D

Worm
03-23-2004, 05:59 AM
Try this...

KennyC
03-23-2004, 07:48 AM
Hi Worm,

I had inserted the CD with volume label CD1 before running.

I ran your code and it returns this error comment:



Copying files from CD1:CD1 failed.


Any suggestion, I really appreciate you help, sorry I'm no help myself.

Cheerz:) ;) :(

Worm
03-23-2004, 08:06 AM
:lol

Oops, had a little coding error in that last one.

Try this one.

KennyC
03-23-2004, 03:43 PM
Originally posted by Worm
:lol

Oops, had a little coding error in that last one.

Try this one.

Hi Worm,

I'm getting to really love worms, friggin awesome, you're a champ and a very patient one at that.

Now taking it a little further, can you do this:

1. Add a comment when you first press the button to Insert CD1, then press OK to start copying files to C:\
2. During the copy process, Add a CANCEL button or "X" to stop process.
3. Add a Loop that prompts you to Insert CD2, then press OK to start copying files to C:\, then after that CD has finished, prompts you to Insert CD3 etc.

Also, thinking about it, is it possible to Add a prompt before 1. above where they fill-in the Drive letter to copy the files to J:\ incase their C:\ doesn't have sufficient space and this parameter is then carried on for the rest of the process so all 6 Cd's are copied.

If they don't insert the correct sequence of CD's, they get prompted to insert the correct one.

I know you're doing all the work, but I do look at what you are doing, then try to incorporate hopefully what I learn into new projects. :lol

Thankz again, much appreciated. :p

Cheerz :) ;) :lol

Worm
03-23-2004, 03:48 PM
You try first, then post the code when you run into problems. I could write the whole thing for you, but you won't get much out of it.

I'm more than willing to help you along the way, but I'd rather steer you in the right direction, than drive you to the destination.

KennyC
03-24-2004, 08:00 AM
Check the next post, worked out how to save an .apz.

Cheerz

Worm
03-24-2004, 08:15 AM
To create a APZ, use File/Export.

I'll take a look at this in a little while, and get back with you.

KennyC
03-24-2004, 08:16 AM
Hi Worm,

I'm not getting very far, sorry :oops

I've done a bit of coding in dBase5 and Excel sometime back, but I'm not really familar with this language, even though I've used the immediate IF (IIF) command in dBase5 many times.

I'm not sure how to get it into a LOOP so CD1, then CD2 can be done.

I wonder if it would simpler for me to do, and the others who may use it, if I used 6 buttons, one for each CD.

If I go with the individual buttons, I may need a prompt if they insert the wrong CD, like the button is for CD2 and they insert CD3.

I also notice that when testing, I get an error as autorun.exe didn't completely UNLOAD.

Cheerz:) ;) :lol

TJ_Tigger
03-24-2004, 08:19 AM
Originally posted by KennyC

I'm getting to really love worms, friggin awesome, you're a champ and a very patient one at that.

Worm
03-24-2004, 09:28 AM
Try this.

KennyC
03-24-2004, 03:50 PM
Hi Worm,

Thankz, starting to look really good.

I get an error after it has finished copying CD1, not sure why.

(I've made no modifications at this stage)

Worm
03-24-2004, 03:52 PM
Before it asks for CD2 or after?

KennyC
03-24-2004, 03:54 PM
Hi,

That was quick.

After copying CD1 to hard drive, but before it asked for CD2.

Worm
03-24-2004, 03:56 PM
I'm looking into it.

Worm
03-24-2004, 03:58 PM
oops! Found a mistake.

Try this.

KennyC
03-25-2004, 06:20 AM
Hi worm,

Me again, sorry :oops

Your last one works well :).

Taking it one step further, I've made some changes, but you guessed, not working. :oops

What I'm trying to do now is:

Lines 2 & 3
Allow the user to select the hard-drive to copy the CD's to.

Lines 5 - 16
Check that sufficient space is available for the selected hard-drive. If insufficient space, then prompt if they want to select another hard-drive, or cancel make more space then try again.

Lines 21 - 25
Copy the CD's to the destination hard-drive they selected in 2 & 3.

I'm starting to understand what you are doing, I'm just not familiar with what to do next.

What language can I read up on to try and understand more, or is it fairly unique to AMS.

Cheerz :) ;) :lol

Worm
03-25-2004, 11:50 AM
try this

Worm
03-25-2004, 02:24 PM
Are you wanting to have them choose a drive to copy to, or a folder to copy to?

KennyC
03-25-2004, 02:36 PM
Hi worm,

I want the user to input a Hard-Drive to copy to, just as it is and the correct folder is being created by the action.

It's absolutely, absolutely brilliant ;)

You make it appear so simple when you've completed a task, I just wish it was.

Are you using the pre-defined Actions from within AMS, or creating your own?

I'll do some configuring now, just including additional dialogue popups, and I'll do some complete tests, but initial tests work 100%.

Cheerz:) ;) :lol

KennyC
03-25-2004, 04:21 PM
Hi worm,

I've added some dialogue and also a CANCEL buttom at Lines 30 and 31.

How do I now get it to say:

Copying of CDs has been cancelled.

It says if the cancel button is pressed:


Title: Copying CD1

Dialogue: Copy was successful


This would need to be the case if any of the CD's being copied was cancelled.

Worm
03-25-2004, 10:29 PM
I've added a new DLL to this that lets you select the drive instead of using the Folder Dialog. I think its a little cleaner.

KennyC
03-26-2004, 10:30 AM
Hi Worm :ok ,

I think the the copying CD's part is OK.

The Create DVD ISO needs some work, sorry. I've started it, not very well. :(

1. Box to browse to the folder created by the copying CD's in the previous step. (this folder location needs to get passed onto where C:\\DVD is on Line 16)

2. Box to display available hard drives and browse to where you want DVD.ISO created, check space available (this hard drive location needs to get passed onto where I:\\DVD.ISO )s on Lne 16)

3. ISO creation successful or ISO creation failed.

I really apologise the time you have spent on this project, it's become more involved than I initially expected. The previous projects I've created using AMS 4 and 5 have basically only required pointing to individual files to run, sorry.

Cheerz :) ;) :lol

Worm
03-26-2004, 10:58 AM
I'm not sure how you're going to trap for errors when you execute the cdimage.exe file, but here is the rest of it.

KennyC
03-26-2004, 02:54 PM
Hi worm,

I can't detect any differences in the last file I got from you, compared to the last I uploaded.

Cheerz:) ;) :lol

Worm
03-26-2004, 03:04 PM
Maybe I grabbed the wrong one :eek:

Try this

KennyC
03-26-2004, 07:09 PM
Hi,

I've changed the events slightly, but still getting a space available error on C:\ no matter where I direct AMS to create the DVD.iso.

I've -- text noted the space available lines so I could see if CDImage will run.

It runs, but it's not passing on the parameters from lines 2 and 7.

It creates a file called strDrive in the CD-ROOT directory of this project and if I give it a .ISO extension, it consists of the files and folders within the CD_ROOT of this project.

I'm not sure whether you know CDImage, very handy for creating command-line .ISO images. However, as it is a DOS based program, it may not beable to accept the parameters from AMS from lines 2 and 7.

CDImage simplified:

Assuming I have made these selections:
strDrive -> C:\DVD
strDriveISO -> I:\DVD.iso
the completed command-line for creating the .ISO section should be:

cdimage.exe", "-lDVD -h -n -m -o -x C\DVD I:\DVD.iso


Parameter meanings:


Usage: CDIMAGE [options] sourceroot targetfile

-l volume label, no spaces (e.g. -lMYLABEL)
-h include hidden files and directories
-x compute and encode "AutoCRC" values in image
-o optimize storage by encoding duplicate files only once
-m ignore maximum image size of 681,984,000 bytes


I've included an image of CDImage in action, note strDrive.

I'm not sure, but the only way I may beable to do this task if have the user make some simple editing to a batch file, not sure, you may have a better idea about using DOS based programs and AMS.

Cheerz :) ;) :lol

KennyC
03-26-2004, 07:12 PM
Hi worm, :oops

Slightly altered .apz.

Cheerz:) ;) :lol

Worm
03-27-2004, 09:47 PM
Sorry for the delay, I've not been in a position to check the forum.

Change the File.Run to this:


File.Run("AutoPlay\\Docs\\cdimage.exe", "-lDVD -h -n -m -o -x " .. strDrive .. " " .. strDriveISO .. "DVD.iso", "", SW_SHOWNORMAL, true);

Corey
03-27-2004, 10:23 PM
Fish bait... :D What next? :eek:

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

KennyC
03-28-2004, 09:35 PM
Hi Worm,

I thought it was working great, well at least the copy CD's to hard-drive, thought I better test on my laptop.

What I found, is if C:\ has less than the 3700Mbs available, this effects the results even if selecting a partition with say 7000Mbs free.

I was having problems still with the 2nd part, creating the DVD.iso using CDImage. Maybe CDImage just won't accept command-line parameters from AMS, not sure.

I created a 4 page batch file and this works fine. If anything is obvious, let me know, but I've taken up far too much of your time already, and I'm really sorry about that. :(

I know this is not your role or desire to write AMS projects for newbies :(

Hope to hear from you again, appreciate you help and especially your outstanding patience, I don't know how you put up with people like meeeeeeeee. :(

Cheerz:) ;) :oops

Corey
03-28-2004, 09:39 PM
Ze thumb!!! Yohohoeeee!!!

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)