Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2005
    Posts
    2

    Check for CD files..?

    I would like my installer to check for a product CD before allowing the user to continue with the installation.

    I have the following code used in On Start:

    Code:
    tblDrives = Drive.Enumerate();
    if(tblDrives)then
    	for i, strDrive in tblDrives do
    		nType = Drive.GetType(strDrive);
    		if(nType == 5)then
    			tblResults = File.Find(strDrive,"*.*", true, false, nil);
    				if tblResults then
    					Altcd = 1;
    				else
    					Altcd = 2;
    				end
    				
    				if Altcd == 2 then
        				result = Dialog.Message("Notice", "The specified file does not exist.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    				end
    		end
    	end
    end
    The problem is that I have 2 CD drives. With the above code and the product CD in one drive, the absence of a product CD (or any CD in the above example) in the second CD drive causes the message box to display.

    Is there a way to work around this? Any suggestions would be appreciated.

  2. #2
    Corey is offline Indigo Rose Staff Alumni
    Join Date
    Aug 2002
    Posts
    9,746
    I'm sure someone will be able to answer this. In the meantime I checked out your profile link to that Concorde add-on for MS flight simulator, pretty neat. I know there's some mighty big fans of MS flight simulator around here.

  3. #3
    Join Date
    Oct 2001
    Location
    Norway
    Posts
    939
    Use the function g_GetDriveLetters() (in _SUF70_Global_Functions.lua) with the argument DRIVE_CDROM.

    Code:
    tCDdrives = g_GetDriveLetters(DRIVE_CDROM);
    if tCDdrives then
    	sCDdrive = "";
    	for index, data in tCDdrives do
    		sCDdrive = sCDdrive..data;
    	end
    	Dialog.Message("CD Drives", sCDdrive);
    	
    End
    Test each entry in the table until you find your file (while/end).

    There is a lot of gunpowder in _SUF70_Global_Functions.lua.

  4. #4
    Join Date
    Aug 2005
    Posts
    2
    Thanks for your suggestion csd214. I’ve played around with the code and used a short loop to check any CD drives before presenting the user with the installer interface, or an error message requesting that the CD be placed in the CD drive.

  5. #5
    Join Date
    Nov 2005
    Posts
    1

    Arrow Need Help

    How can I check if a CD is in drive, without knowing anything about that CD?

  6. #6
    Join Date
    Oct 2001
    Location
    Norway
    Posts
    939
    Welcome to the forum, Reflexive. Sorry you had to wait for an answer.

    A suggestion to achieve what you want:
    Code:
    sCdDrive = "G:";	-- drive letter is determined
    tInfo = Drive.GetInformation(sCdDrive);
    nError = Application.GetLastError();
    if (nError ~= 0) then
         -- some kind of error has occurred!
         if nError == 2104 then
         	-- Error #2104 = "Failed to get volume information."
         	Dialog.Message("Error", "Drive "..sCdDrive.." is empty!");
    --     else
    --		Dialog.Message("Feil ", "Feil # " ..nError.."\r\n".. _tblErrorMessages[nError], MB_OK, MB_ICONSTOP);
    	end
    	Application.ExitScript();	-- a usefull command!
    end	
    
    Dialog.Message("Drive "..sCdDrive, "CD is found. The drive is NOT empty.", MB_OK, MB_ICONINFORMATION);

Similar Threads

  1. Removing Unused Files from Your Project
    By Desmond in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 09-26-2003, 10:07 AM
  2. method to index/compare user's files for update?
    By intel352 in forum Setup Factory 6.0
    Replies: 0
    Last Post: 01-15-2003, 03:08 PM
  3. INFO: Why Files are Renamed in the DATA Folder
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-24-2002, 03:36 PM
  4. HOWTO: "Hide" Externally Referenced Files
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-23-2002, 03:19 PM
  5. HOWTO: Remove Files that were Installed by a Patch or Alternate Source
    By Support in forum Setup Factory 6.0 Knowledge Base
    Replies: 0
    Last Post: 09-24-2002, 09:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts