Announcement

Collapse
No announcement yet.

Checking for CD

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Checking for CD

    Hi,

    another beginner question here .

    How can I check if a CD has been inserted into "any" CD Drive (in the case the user has more then one), and then assign the respective CD drive to a variable?

    Cheers

  • #2
    Re: Checking for CD

    Already done for you. Check out the variable named %SrcDrv%.
    --[[ Indigo Rose Software Developer ]]

    Comment


    • #3
      Re: Checking for CD

      Yes, I know about this variable. In my case the Autoplay application would be started from the HD (sorry for beeing unclear abou that). I want to give the user the possibility of a "Browse CD" feature.

      So if I would use the %SrcDrv% variable it would open the HD location were the Autorun app would have been started from. Or am I wrong?

      Comment


      • #4
        Re: Checking for CD

        In my case the Autoplay application would be started from the HD (sorry for beeing unclear abou that). I want to give the user the possibility of a "Browse CD" feature.
        I am assuming then, the CD isnt part of the AMS project, or it would be running from CD, right?
        What if the user has 2 or 3 CD drives and perhaps a virtual CD drive too? which one do you choose, especially if more than one drive has a CD in it?

        Given this, i would be tempted to use:
        File.Execute ("%WinDir%\explorer.exe", "/n,", Continue)
        ... and let the user choose the drive. Of course, i dont know if this would be any good for you. A possibility tho.
        -
        = Derek
        ["All glory comes from daring to begin" - fortune cookie]

        Comment


        • #5
          Re: Checking for CD

          If the CD being inserted is a CD of yours or a CD over which you have some control then just insert a key file on the top level, i.e. V4201C.txt (any name or file type will work) and then search for that file on all drives form your main app (no recurse sub-directory). Should be able to quickly determine which drive contains that file and assign a path variable to it...

          Corey Milner
          Creative Director, Indigo Rose Software

          Comment


          • #6
            Re: Checking for CD

            This is a quick little thing you can do to test for CD-ROM drives:

            <IR_ACTIONS_LIST>
            <Action name="Set Value">
            <Type>6</Type>
            <Function>0</Function>
            <DTIndentLevel>0</DTIndentLevel>
            <Enabled>1</Enabled>
            <ErrorHandling>
            <UserNotificationMode>2</UserNotificationMode>
            <CustomErrorMessage/>
            <OnErrorAction>0</OnErrorAction>
            <JumpToLabel/>
            </ErrorHandling>
            <Variable>%ctr%</Variable>
            <Value>0</Value>
            <Evaluate>0</Evaluate>
            </Action>
            <Action name="Set Value">
            <Type>6</Type>
            <Function>0</Function>
            <DTIndentLevel>0</DTIndentLevel>
            <Enabled>1</Enabled>
            <ErrorHandling>
            <UserNotificationMode>2</UserNotificationMode>
            <CustomErrorMessage/>
            <OnErrorAction>0</OnErrorAction>
            <JumpToLabel/>
            </ErrorHandling>
            <Variable>%CDs%</Variable>
            <Value/>
            <Evaluate>0</Evaluate>
            </Action>
            <Action name="Set Value">
            <Type>6</Type>
            <Function>0</Function>
            <DTIndentLevel>0</DTIndentLevel>
            <Enabled>1</Enabled>
            <ErrorHandling>
            <UserNotificationMode>2</UserNotificationMode>
            <CustomErrorMessage/>
            <OnErrorAction>0</OnErrorAction>
            <JumpToLabel/>
            </ErrorHandling>
            <Variable>%driveletter%</Variable>
            <Value>A B C D E F G H I J K L M N O P Q R S T U V W X Y Z</Value>
            <Evaluate>0</Evaluate>
            </Action>
            <Action name="Count Delimited Strings">
            <Type>63</Type>
            <Function>0</Function>
            <DTIndentLevel>0</DTIndentLevel>
            <Enabled>1</Enabled>
            <ErrorHandling>
            <UserNotificationMode>2</UserNotificationMode>
            <CustomErrorMessage/>
            <OnErrorAction>0</OnErrorAction>
            <JumpToLabel/>
            </ErrorHandling>
            <Variable>%count%</Variable>
            <Source>%driveletter%</Source>
            <Delimiter> </Delimiter>
            </Action>
            <Action name="WHILE">
            <Type>204</Type>
            <Function>1</Function>
            <DTIndentLevel>0</DTIndentLevel>
            <Enabled>1</Enabled>
            <ErrorHandling>
            <UserNotificationMode>2</UserNotificationMode>
            <CustomErrorMessage/>
            <OnErrorAction>0</OnErrorAction>
            <JumpToLabel/>
            </ErrorHandling>
            <Condition>%ctr% &amp;lt; %count%
            </Condition>
            </Action>
            <Action name="Get Delimited String">
            <Type>64</Type>
            <Function>0</Function>
            <DTIndentLevel>1</DTIndentLevel>
            <Enabled>1</Enabled>
            <ErrorHandling>
            <UserNotificationMode>2</UserNotificationMode>
            <CustomErrorMessage/>
            <OnErrorAction>0</OnErrorAction>
            <JumpToLabel/>
            </ErrorHandling>
            <Variable>%drive%</Variable>
            <Source>%driveletter%</Source>
            <Delimiter> </Delimiter>
            <ItemIndex>%ctr%</ItemIndex>
            </Action>
            <Action name="Get Drive Information">
            <Type>133</Type>
            <Function>0</Function>
            <DTIndentLevel>1</DTIndentLevel>
            <Enabled>1</Enabled>
            <ErrorHandling>
            <UserNotificationMode>2</UserNotificationMode>
            <CustomErrorMessage/>
            <OnErrorAction>0</OnErrorAction>
            <JumpToLabel/>
            </ErrorHandling>
            <Variable>%Property%</Variable>
            <Drive>%drive%:\</Drive>
            <Property>Type</Property>
            </Action>
            <Action name="IF">
            <Type>200</Type>
            <Function>1</Function>
            <DTIndentLevel>1</DTIndentLevel>
            <Enabled>1</Enabled>
            <ErrorHandling>
            <UserNotificationMode>2</UserNotificationMode>
            <CustomErrorMessage/>
            <OnErrorAction>0</OnErrorAction>
            <JumpToLabel/>
            </ErrorHandling>
            <Condition>%Property% ="CD-ROM"</Condition>
            </Action>
            <Action name="Set Value">
            <Type>6</Type>
            <Function>0</Function>
            <DTIndentLevel>2</DTIndentLevel>
            <Enabled>1</Enabled>
            <ErrorHandling>
            <UserNotificationMode>2</UserNotificationMode>
            <CustomErrorMessage/>
            <OnErrorAction>0</OnErrorAction>
            <JumpToLabel/>
            </ErrorHandling>
            <Variable>%CDs%</Variable>
            <Value>%CDs% %Drive% </Value>
            <Evaluate>0</Evaluate>
            </Action>
            <Action name="END IF">
            <Type>201</Type>
            <Function>1</Function>
            <DTIndentLevel>1</DTIndentLevel>
            <Enabled>1</Enabled>
            <ErrorHandling>
            <UserNotificationMode>2</UserNotificationMode>
            <CustomErrorMessage/>
            <OnErrorAction>0</OnErrorAction>
            <JumpToLabel/>
            </ErrorHandling>
            </Action>
            <Action name="Set Value">
            <Type>6</Type>
            <Function>0</Function>
            <DTIndentLevel>1</DTIndentLevel>
            <Enabled>1</Enabled>
            <ErrorHandling>
            <UserNotificationMode>2</UserNotificationMode>
            <CustomErrorMessage/>
            <OnErrorAction>0</OnErrorAction>
            <JumpToLabel/>
            </ErrorHandling>
            <Variable>%ctr%</Variable>
            <Value>%ctr% + 1</Value>
            <Evaluate>1</Evaluate>
            </Action>
            <Action name="END WHILE">
            <Type>205</Type>
            <Function>1</Function>
            <DTIndentLevel>0</DTIndentLevel>
            <Enabled>1</Enabled>
            <ErrorHandling>
            <UserNotificationMode>2</UserNotificationMode>
            <CustomErrorMessage/>
            <OnErrorAction>0</OnErrorAction>
            <JumpToLabel/>
            </ErrorHandling>
            </Action>
            <Action name="Message Box">
            <Type>5</Type>
            <Function>0</Function>
            <DTIndentLevel>0</DTIndentLevel>
            <Enabled>1</Enabled>
            <ErrorHandling>
            <UserNotificationMode>2</UserNotificationMode>
            <CustomErrorMessage/>
            <OnErrorAction>0</OnErrorAction>
            <JumpToLabel/>
            </ErrorHandling>
            <DialogTitle>CDs</DialogTitle>
            <DialogMessage>Your CD-ROM Drives are:

            %CDs%</DialogMessage>
            <Icon>3</Icon>
            <Variable>%Result%</Variable>
            <DialogType>0</DialogType>
            <DefaultButton>0</DefaultButton>
            </Action>
            </IR_ACTIONS_LIST>

            Comment


            • #7
              Re: Checking for CD

              One of the things I love about this forum is all the cool code that is placed on here. There are some actions that I have not used and when I see them on here it gives me ideas. What a great place.
              TJ-Tigger
              "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
              "Draco dormiens nunquam titillandus."
              Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

              Comment

              Working...
              X