BigDaddyO Posted January 16, 2007 Share Posted January 16, 2007 (edited) I found an ActiveX control called Data Burner. It's $100 for a developer license but you can download a free Trial version to play with that has VB and C examples.EDIT: Just found out the hard way that this does not work with Vista!, yet their web site says it willHere is some working code that I am using for my POC Backup script.expandcollapse popup$FileToBurn = "D:\Temp\Testfile.txt" $TargetFolder = "9" $Volume = "Backup" $DBCheckSize = ObjCreate("DATABURNER.databurnerCtrl.1") if IsObj($DBCheckSize) Then $DBCheckSize.InitControl $DBCheckSize.Drive=0 if $DBCheckSize.GetMediaFreeSpace < FileGetSize($FileToBurn) Then MsgBox(0, "Media error", "Not enough free space available on the inserted media") Exit EndIf EndIf $DBurn = ObjCreate("DATABURNER.databurnerCtrl.1") $DBurnEvent = ObjEvent($DBurn, "databurner1_") ;<- Does not seem to work if IsObj($DBurn) Then With $DBurn .InitControl .CreateFolder($TargetFolder & "\") .addfile($TargetFolder & "\",$FileToBurn) .Drive=0 .VolumeName = $Volume .burn(False,False,True) EndWith ProgressOn("Backup to CD", "Your Data is being Backed up", "Initilizing the CD-R Drive", 0, 0) While 1 sleep(10) WEnd Else MsgBox(0, "", "Failed to create object") EndIf Func DataBurner1_ClosingDisc($Seconds) ProgressSet(100, "Closing Current Session") sleep($Seconds * 1000) ProgressOff() MsgBox(0, "Finished", "Finished creating CD") Exit EndFunc Func Databurner1_Progress($CompletedSteps, $TotalSteps) $BurnPercent = Round(($CompletedSteps / $TotalSteps) * 100) ProgressSet($BurnPercent, "Percent Complete = " & $BurnPercent) EndFunc Func DataBurner1_($Message) MsgBox(0, "Unknown Message", $Message) EndFuncIf anybody has any ideas on how to get the ObjEvent to work I would really appreciate some feedback.edit: Updated Code, now Fully functionalMike Edited January 17, 2007 by MikeOsdx Link to comment Share on other sites More sharing options...
ptrex Posted January 16, 2007 Share Posted January 16, 2007 @MikeOsdx Open the AutoIT help file. Go to AutoIT -> Fucntions Reference -> obj/COM reference. press CTRL + F Fill in EVENT press find now. Start to read this section first. This is a good way to get your problem sorted. regards ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
BigDaddyO Posted January 16, 2007 Author Share Posted January 16, 2007 Cool, I got it working. For some strange reason AutoIT can't read the ErrorEvent or the BurnComplete events from the Data Burner. I have got it working by using the Progress event to display a decent progress screen, then I use the ClosingDisc event which returns the estimated time for closing to sleep the program that long. It's not very acurate for the first burn on the CD but all other burns are almost exact. Mike. Link to comment Share on other sites More sharing options...
nobbe Posted January 16, 2007 Share Posted January 16, 2007 hi have you tried to use the nero object also? Link to comment Share on other sites More sharing options...
BigDaddyO Posted January 16, 2007 Author Share Posted January 16, 2007 hi have you tried to use the nero object also?You would have to have a Nero License for each computer that would be using it, Right?With this Data Burner, it's a developer license, so I distribute the files with my exe and the end user doesn't have to have Nero or purchase anything else.Mike Link to comment Share on other sites More sharing options...
nobbe Posted January 17, 2007 Share Posted January 17, 2007 hi i understand - thats a good point i work for a bigger company so the lic for nero was already there , i wrote interface with c++ once using the nero toolkit.. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now