Jump to content

Cd&dvd Aç&kapat


mrecep38
 Share

Recommended Posts

Local $CDROM = DriveGetDrive( "CDROM" )
If NOT @error Then
For $i = 1 to $CDROM[0]
CDTray($CDROM[$i], "open")
Next
EndIf

Local $CDROM = DriveGetDrive( "CDROM" )
If NOT @error Then
For $i = 1 to $CDROM[0]
CDTray($CDROM[$i], "close")
Next
EndIf


Kodlarıyla cd ya da dvd sürücülerini açıp, kapayabiliyoruz.

Ancak bu kod, cd sürücüsünü açıp tekrar hemen kapatıyor.

Yapmak istediğim; eğer cd sürücüsü açıksa sadece kapayacak,

kapalıysa sadece açacak. Tek scriptte bu iki özelliği nasıl sağlayabilirim?

Windows 7 x 64 kullanıyorum. Edited by mrecep38
Link to comment
Share on other sites

[font="Georgia"]Ben böyle yazdım farklı şekillerde de yapılabilir.[/font]
[codebox]Opt("MustDeclareVars", 1)
Global $drive, $count = 1, $var

$drive = DriveGetDrive("CDROM")
$var = $drive[0]

Global $drivestatus[$var]

While $drive[0] <> 0
if $count <> ($drive[0]) Then
if $drivestatus[$count] <> 1 Then
CDTray($drive[$count], "open")
$drivestatus[$count] = 1
Else
CDTray($drive[$count], "closed")
$drivestatus[$count] = 0
$count += 1
EndIf
Else
$count = 1
EndIf
Sleep(200)
WEnd[/codebox]

Link to comment
Share on other sites

[font="Georgia"]Sana verdiğim kodlarda hiç bir hata yok bende çalışıyor ayrıca kendi bilgisayarıma özel yazmadım bütün bilgisayarlarda çalışır sende bir sorun vardır. sciTE de F5 yap bakalım olacak mı ?[/font]

Link to comment
Share on other sites

Söylediğini yapmak için, önce cd/dvd nin açık olup olmadığını kontrol etmek gerekiyor.
Biraz araştırmanı öneririm. Dur senin için hızlı bir gözatım...

Sekizinci mesajdaki örnek güzel görünüyor!
[color="#0000FF"][u][b]http://www.autoitscript.com/forum/topic/94904-detect-opened-cd-rom/page__view__findpost__p__681957[/b][/u][/color]

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...