Sign in to follow this  
Followers 0
manmoncang

How To Detect Cd Drive Automatically

3 posts in this topic

Sorry again coz i weak in programming. Just beginner

i have a file in CD and i want open that file using GUI. Let's say the file name is file.pdf

The problem is, not all computer assign same character for CD Drive like in my laptop, it is E:\ and my Dekstop is I:\ and so on

Thus how to makesure when people press button in GUI, thus the computer know the CD drive and open that file. Tq

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

maybe... put this first, change the use to PDF files

$var = FileOpenDialog($message, "C:\Windows\", "Images (*.jpg;*.bmp)", 1 + 4 )

If @error Then
    MsgBox(4096,"","No File(s) chosen")
Else
    $var = StringReplace($var, "|", @CRLF)
    MsgBox(4096,"","You chose " & $var)
EndIf

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

Here:

$file_relative_path = "myfolder\myotherfolder\myfile.pdf"
$drive="<not_known>"
For $i = Asc('a') to asc('z')
   If DriveGetType ( Chr($i) & ":" ) = "CDROM" And DriveStatus ( Chr($i) & ":" ) = "READY" Then
       $drive = Chr($i)
       ExitLoop
   EndIf
Next
If $drive="<not_known>" Then
   MSGBOX(0, "No CDROM found", 'Sorry =.="')
EndIf
Run('run "'&drive&':\'&$file_relative_path&'"')

#)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0