Jump to content

CD/DVD Burning UDF


monoceres
 Share

Recommended Posts

One question :

How can I delete a folder/file from the fs ? Is it possible ?

(I'm planning to do an app for this UDF ... :) )

Cheers,

L|M|TER

I will make a function for it, but you can do it yourself quite simple:

$oFileSystem.RemoveTree("Some dir")

muttley

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

  • Replies 70
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I will make a function for it, but you can do it yourself quite simple:

$oFileSystem.RemoveTree("Some dir")

muttley

Scratch that, this is the correct way of doing it:

$oRoot=$oFileSystem.Root
$oRoot.RemoveTree("Some tree structure")

Silly me :)

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

  • 2 weeks later...

I am studying how to implement burning cd or dvd by useing imapi.Now I meet some questions. I have download the KB932716 update file,but it appears somes problems.

"Setup cannot update your Windows XP files because the language installed on your system is different from the update language."

How should I do ?

Link to comment
Share on other sites

  • 4 weeks later...

Just a quick question....do you know how to find out information about the burner? I want to know if a burner can burn dvd-r's, dvd+r's, etc...THANKS!

Hi!

I will look into it and post an update :P

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

Hi!

I will look into it and post an update :P

Two new functions added.

_IMAPI2_DriveGetSupportedMedia()

- Returns an array of media types that is supported by a drive that corresponds to the constants defined in the top of the UDF

_IMAPI2_DriveMediaIsBlank()

- Returns true if the inserted media in a drive is blank

:P

Edited by monoceres

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

New update!

Finally some iso support! :P

New functions:

  • _IMAPI2_BurnImageToDrive
  • _IMAPI2_AddFileToFS
  • _IMAPI2_CreateFSForMedia
  • _IMAPI2_FSCountDirectories
  • _IMAPI2_FSCountFiles
  • _IMAPI2_FSItemExists
  • _IMAPI2_DriveMediaFreeSpace
  • _IMAPI2_DriveMediaTotalSpace

Enjoy :P

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

this is great UDF, but just have a few Q's

i'm trying to get a progress feedback bat can't get it to work, the best i've done is that it chages once at the end, but it don't show progress as it burns, am i using the function wrong?

modified IMAPI2_Example.au3

$fs=_IMAPI2_CreateFSForDrive($drive,"Sample Title"); Create a filesystem
_IMAPI2_AddFolderToFS($fs,$folder)
ProgressOn("Progress Meter", "Ouch! that burns!", "ready...")

_IMAPI2_BurnFSToDrive($fs,$drive,"_Progress")

ProgressSet(100 , "Done", "Complete")
sleep(500)
ProgressOff()
_IMAPI2_DriveEject($drive)

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)

    ProgressSet((Round($array[2])/Round($array[3])*100),"Current action: "&$array[0] & " Remaing time: "&$array[1] & " Elapsed time: "&$array[2] & " Total time: "&$array[3])

EndFunc

also, when i put in a disc and click OK the default windows "what do you want to do with this disc" dialog box comes up, is there a way i can stop it from coming up? (WinXP/SP3) or should i just WinActive to check for it and close it?

My AutoIt Scripts.- AutoHost and Password Enabler for Delta Force 2 Demo.| Caffine for Winamp 2.9x and WRS 2.0 | mp3 directory cleaner | CRAP DJ | A:B:J Radio Automation Software | FFMPEG batch conversion automator

Link to comment
Share on other sites

this is great UDF, but just have a few Q's

i'm trying to get a progress feedback bat can't get it to work, the best i've done is that it chages once at the end, but it don't show progress as it burns, am i using the function wrong?

Snipped

also, when i put in a disc and click OK the default windows "what do you want to do with this disc" dialog box comes up, is there a way i can stop it from coming up? (WinXP/SP3) or should i just WinActive to check for it and close it?

Ii actually works that way for me too, but my burner is in a really bad shape and since nobody else noticed this I thought it was my burner (my computer almost completely freeze when burning anything). I will try to find a solution when I get the time :P

I think the WinActive solution will wrk, but I'm convinced that there is another solution, same as above.

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

  • 2 weeks later...

Does anyone know the steps required to append files to an un-finalized CD-R? I'm thinking you have to read in the FS somehow and then combine it with your new files before writing it backl or you'll lose reference to the existing files.

Anyone tried getting this to work?

Thanks.

Link to comment
Share on other sites

Does anyone know the steps required to append files to an un-finalized CD-R? I'm thinking you have to read in the FS somehow and then combine it with your new files before writing it backl or you'll lose reference to the existing files.

Anyone tried getting this to work?

Thanks.

Hi!

There are methods in the IFileSystemImage object that allows you to import the filesystem on the inserted media. When I get the time, I'll incorporate them into the UDF :P

Methods in the IFileSystemImage object

http://msdn.microsoft.com/en-us/library/aa365634(VS.85).aspx

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

Hi!

There are methods in the IFileSystemImage object that allows you to import the filesystem on the inserted media. When I get the time, I'll incorporate them into the UDF :P

Methods in the IFileSystemImage object

http://msdn.microsoft.com/en-us/library/aa365634(VS.85).aspx

I found this out there... seems like just what the doctor ordered:

"Creating a Multisession Disc"

http://msdn.microsoft.com/en-us/library/bb870772(VS.85).aspx

Link to comment
Share on other sites

This will help me imensly. Not sure how to spell that.

I found a bug though. I am running xp with sp3 and came across this error msg.

C:\Program Files\AutoIt3\Include\IMAPI2.au3 (274) : ==> Subscript used with non-Array variable.:

Return StringLeft($sTemp[0], 1)

Return StringLeft($sTemp^ ERROR

How can I make it work properly?

And now this one for some reason:

C:\Program Files\AutoIt3\IMAPI2_Example.au3 (13) : ==> Subscript used with non-Array variable.:

$drive = _IMAPI2_DriveGetObj($ids[2])

$drive = _IMAPI2_DriveGetObj($ids^ ERROR

Help?

Edited by dansxmods
Link to comment
Share on other sites

This will help me imensly. Not sure how to spell that.

I found a bug though. I am running xp with sp3 and came across this error msg.

C:\Program Files\AutoIt3\Include\IMAPI2.au3 (274) : ==> Subscript used with non-Array variable.:

Return StringLeft($sTemp[0], 1)

Return StringLeft($sTemp^ ERROR

How can I make it work properly?

And now this one for some reason:

C:\Program Files\AutoIt3\IMAPI2_Example.au3 (13) : ==> Subscript used with non-Array variable.:

$drive = _IMAPI2_DriveGetObj($ids[2])

$drive = _IMAPI2_DriveGetObj($ids^ ERROR

Help?

I'm guessing your errors are actually a result of a prior statement not populating those variables.

Did you install Microsoft's KB932716-V2 IMAPI2 update?

I scrolled down and went with the 32-bit XP SP2 download. MS claims the hotfix was included in SP3 but googling "IMAPI2" and "SP3" shows others have found missing IMAPI2 dll's after the SP3 update. Manually reinstalling the SP2 version got things working for me.

Edited by Spiff59
Link to comment
Share on other sites

Microsoft's example for appending data to an exisiting open CD, resulting in a multi-session CD almost worked. I made a few coasters and eventually found that the following code works fine. It will add a folder to a blank CD, or, if the CD has data and is not finalized, it will load the data from the prior session, append your new data, then burn a new session with everything intact. I couldn't use the functions in the existing UDF as I needed to reference the Writer object prior to defining the FileSystem. So, here's some working test code, minus any frills, parm-passing, or error checks:

Dim $oDiscmaster, $oRecorder, $oWriter, $oFileSystem, $aDriveInfo[5][5], $drives

; MAIN =========================================================================

$folder = FileSelectFolder("Select source folder to burn to CD", "")
If $folder = "" Then Exit

_IMAPI2_Identify_Drives()

;For $x = 1 to $drives
;   MsgBox(1,"","Drive " & $x & ": " & $aDriveInfo[$x][1] & "   " & $aDriveInfo[$x][2] & " " & $aDriveInfo[$x][3] & " " & $aDriveInfo[$x][4])
;Next

_IMAPI2_FolderToCD($aDriveInfo[1][0])
MsgBox(1,"","Done!")
Exit

; SUBROUTINES ==================================================================

Func _IMAPI2_Identify_Drives()
    $oDiscmaster = ObjCreate("IMAPI2.MsftDiscMaster2")
    If Not IsObj($oDiscmaster) Then 
        Msgbox(1,"","ObjCreate error: IMAPI2.MsftDiscMaster2")
        Exit
    EndIf
    $drives = 0
    For $x = 0 To $oDiscmaster.Count() - 1
        $oRecorder = ObjCreate("IMAPI2.MsftDiscRecorder2")
        If Not IsObj($oRecorder) Then 
            Msgbox(1,"","ObjCreate error: IMAPI2.MsftDiscRecorder2")
            Exit
        EndIf
    ; bypass DaemonTools/Roxio/MagicISO virtual 'SCSI' drives as they crash IMAPI2. IDE and USB drives work fine.       
        If StringMid($oDiscmaster.Item($x), 5, 4) <> "scsi" Then 
            $oRecorder.InitializeDiscRecorder($oDiscmaster.Item($x))
            $drives += 1
            $aDriveInfo[$drives][0] = $oDiscmaster.Item($x); Drive Identifier
            $z = $oRecorder.VolumePathNames
            $aDriveInfo[$drives][1] = $z[0]; Drive Letter
            $aDriveInfo[$drives][2] = $oRecorder.VendorId
            $aDriveInfo[$drives][3] = $oRecorder.ProductId
            $aDriveInfo[$drives][4] = $oRecorder.ProductRevision
        EndIf
    Next
    $oDiscmaster = ""
EndFunc

;-------------------------------------------------------------------------------
Func _IMAPI2_FolderToCD($curdrive)
    $oRecorder = ObjCreate("IMAPI2.MsftDiscRecorder2")
    $oRecorder.InitializeDiscRecorder($curdrive)
    
    $oWriter = ObjCreate("IMAPI2.MsftDiscFormat2Data")
    $oWriter.recorder = $oRecorder
    $oWriter.ClientName = @ScriptName

    $oFileSystem = ObjCreate("IMAPI2FS.MsftFileSystemImage")
    
    If $oWriter.MediaHeuristicallyBlank Then
        $oFileSystem.ChooseImageDefaults($oRecorder)
    Else 
        $oFileSystem.MultisessionInterfaces = $oWriter.MultisessionInterfaces
        $oFileSystem.ImportFileSystem()
    EndIf

    $oFileSystem.FileSystemsToCreate = 3; ISO9660 + Joliet
    $oFileSystem.VolumeName = "X-Ray Images"

    $oRootDir = $oFileSystem.Root
    $oRootDir.AddTree($folder, False)

    $oResult = $oFileSystem.CreateResultImage()
    $vStream = $oResult.ImageStream
    $oWriter.write($vStream); bypass to save cd'S during testing
    $oFileSystem = ""
    $oWriter = ""
    $oRecorder = ""
EndFunc
Link to comment
Share on other sites

  • 2 weeks later...

@monoceres

I got a ? for ya that maybe you can help me understand. I'm getting closer and closer to integrating this wonderful UDF into my burner script; and I was looking through your code and got confused about a func. The FSItemExists func. The func basically return the value of an object method called Exists. My question is (since I haven't got far enough along to test yet) what if you have two files of the same name but in different directories. Do you know how the object method handles that?

Spoiler

Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder
Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array
Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc
Cool Stuff: AutoItObject UDF â—Š Extract Icon From Proc â—Š GuiCtrlFontRotate â—Š Hex Edit Funcs â—Š Run binary â—Š Service_UDF

 

Link to comment
Share on other sites

@monoceres

I got a ? for ya that maybe you can help me understand. I'm getting closer and closer to integrating this wonderful UDF into my burner script; and I was looking through your code and got confused about a func. The FSItemExists func. The func basically return the value of an object method called Exists. My question is (since I haven't got far enough along to test yet) what if you have two files of the same name but in different directories. Do you know how the object method handles that?

Hi!

According to the msdn page it's the full path to the file.

If you read it you will also see that my documentation is wrong about the return type (1 = directory, 2= file).

However I just tested this function and I can't get it to work. I have no idea why. I will check it when I get time. It's not an essential function however so you might wanna think about keeping the info if a file has been added internally.

Broken link? PM me and I'll send you the file!

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...