Jump to content
Sign in to follow this  
Nunos

help

Recommended Posts

Nunos

Trying to get this to work but I am in Do Until Loop hell. :wacko: The result I am looking for is that the burn does not happen unless a blank cd that can be written to is in the drive. But in various experiments I am not getting the desired results. Perhaps someone can tell me what I am doing wrong.

The include is located at the following link.

#include "IMAPI2.au3"

Local $sImage = @DesktopDir & "\my.iso"
; Get the unique ids of all the drives on the system
$ids = _IMAPI2_DrivesGetID()


; Get the object of the first drive
$drive = _IMAPI2_DriveGetObj($ids[1])

Do
_IMAPI2_DriveEject($drive)
MsgBox(64, "Info", "Insert cd-r or cd-rw into drive " & _IMAPI2_DriveGetLetter($drive)& ":")
_IMAPI2_DriveClose($drive)
Do
Sleep(1000)
$code = _IMAPI2_DriveGetMedia($drive)
Until $code <> -1 ; Wait until the drive is ready
Until $code = $IMAPI_MEDIA_TYPE_CDR Or $code = $IMAPI_MEDIA_TYPE_CDRW ; Force the user to insert cd-r or cd-rw


$blank = _IMAPI2_DriveMediaIsBlank($drive)
Do
$blank = False
MsgBox(64, "Info", "The disk is not blank please insert a blank cd-r or cd-rw.")
Do
Sleep(1000)
$code = _IMAPI2_DriveGetMedia($drive)
Until $code <> -1 ; Wait until the drive is ready
Until $blank = True

_IMAPI2_BurnImageToDrive($drive, $sImage,"_Progress")


Func _Progress($array)
ConsoleWrite("Current action: "&$array[0]&@CRLF)
ConsoleWrite("Remaing time: "&$array[1]&@CRLF)
ConsoleWrite("Elapsed time: "&$array[2]&@CRLF)
ConsoleWrite("Total time: "&$array[3]&@CRLF)
EndFunc

_IMAPI2_DriveEject($drive) ; Eject when Burn is complete

Share this post


Link to post
Share on other sites
water

Nunos,

could you please add a more descriptive title to your threads? Everyone on this forum is seeking for help. A descriptive title helps people to easily decide if they can help on the subject.

  • Like 1

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

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  

×