Jump to content

help


Nunos
 Share

Recommended Posts

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
Link to comment
Share on other sites

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.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...