Jump to content

ISO Generator No CD Needed


BigDaddyO
 Share

Recommended Posts

I found this ISO generator called mkisofs.exe on the internet a while ago which allows you to create an ISO file from a folder on your comptuer. Only problem is that It's command line drivin, which I am not a fan of. So, I wrote this very simple script to interface with the mkisofs.exe. I tried to upload the mkisofs.exe and the neccessary cygwin1.dll to my Forum filespace but it won't let me for some reason. oh well, they are open source and can be found via a google search if you are interested.

EDIT: Attached the mkisofs.exe and the cygwin1.dll to this post via the ISOFiles.zip

EDIT2: Added the ability to specify the Volume label in the ISO file. I am not using the beta version of AutoIT so I can't do the STDIO thingy...

EDIT3: Modified to work with the StderrRead from the AutoIT Beta. Now has a Progress. (Thanks for the Assistance DaveF)

;This is a gui interface for the Linix based ISO creator mkisofs.exe
#include <GUIConstants.au3>
#include <Constants.au3>

;This is an example
#cs
  mkisofs -o X:/ISO/Update.iso -J -R X:/LoadCD
    ^     ^    ^            ^  ^    ^
    |      |      |         |  |    |
  Program  |  Output file   Joliet | Source Data
           |                       |
   Specifies Output file       Rock Ridge


CaSe SeNsItIvE SwItChEs

Type:  mkisofs -help for more specific information
#ce

$g_szVersion = "ISOMakerV1"
If WinExists($g_szVersion) Then 
    MsgBox(0, "Error!", "ISO Maker already open")
    WinActivate("ISO Maker", "This will create")
    Exit; It's already running
EndIf
AutoItWinSetTitle($g_szVersion)

FileInstall("mkisofs.exe", @Tempdir & "\mkisofs.exe")
fileinstall("cygwin1.dll", @Tempdir & "\cygwin1.dll")

$MainGUI = GUICreate("ISO Maker", 400, 160)
GUICtrlCreateLabel("This will create an ISO file from the specified folder", 30, 10, 380, 20)
GUICtrlSetFont(-1, 9, 600)
GUICtrlCreateLabel("Volume Label:", 95, 73, 80, 20)
$Volume = GUICtrlCreateInput("", 170, 70, 120, 20)
GUICtrlSetLimit($Volume, 16)
$BtnSource = GUICtrlCreateButton("Source folder", 80, 100, 100, 20)
GUICtrlSetState($BtnSource, $GUI_Disable)
$BtnTarget = GUICtrlCreateButton("Target ISO", 80, 130, 100, 20)
GUICtrlSetState($BtnTarget, $GUI_DISABLE)
$BtnCreate = GUICtrlCreateButton("Create Now", 210, 100, 100, 20)
guictrlsetstate($BtnCreate, $GUI_DISABLE)
$BtnClose = guictrlcreatebutton("Close", 210, 130, 100, 20)
GUICtrlCreateLabel("This may take some time depending upon the size of the ISO", 45, 40, 380, 20)
GUISetState( )

While 1
    $FocusItem = ControlGetFocus("ISO Maker", "This will")
    If $FocusItem = "Edit1" then
        $ReadVolume = guictrlread($Volume)
        if StringLen($ReadVolume) = 1 Then
            GUICtrlSetState($BtnSource, $GUI_Enable)
        EndIf
    EndIf
    
    $msg = GUIGetMsg()
    if $msg = $BtnSource Then
    $dta1 = GUICtrlRead($Volume)
    if StringInStr($dta1, " ") > 0 then
        msgbox(0, "Incorrect Volume", "Volume label can not contain spaces")
        GUICtrlSetData($Volume, "")
        GUICtrlSetState($Volume, $GUI_Focus)
        guictrlsetstate($BtnSource, $GUI_Disable)
        ContinueLoop
    EndIf
    $SourceA = fileselectfolder("Select Source Folder", "")
    if Not @error Then GUICtrlSetState($BtnTarget, $GUI_ENABLE)
    EndIf
    
    if $msg = $BtnTarget Then
    $TargetA = filesavedialog("Target ISO file", "", "IMAGE files (*.ISO)", 16)
        if Not @error then
            if StringInStr($TargetA, ".iso") = 0 then
                $TargetA = $TargetA & ".iso"
            EndIf
            GUICtrlSetState($BtnCreate, $GUI_ENABLE)
        EndIf
    EndIf
    
    If $msg = $BtnCreate Then
        
        $VolumeData = GUICtrlRead($Volume)
        $SourceB = FileGetShortName($SourceA)
        $tmpfile = fileopen($TargetA, 2)
        $TargetB = FileGetShortName($TargetA)
        $TargetC = StringInStr($TargetA, "\", 0, -1)
        $TargetD = Stringleft($TargetA, $TargetC)
        $ISOProgress = ProgressOn("Creating ISO", "Creating:  " & $VolumeData , "Percent Complete")
        fileclose($tmpfile)
        sleep(1000)
        FileDelete($TargetA)
        $Output = run(@ComSpec & " /c " & @TempDir & "\mkisofs -o " & $TargetB & " -J -R -V" & $VolumeData & " " & $SourceB, @TempDir, @SW_HIDE, $STDERR_CHILD)
        $Totalerr = ""
        $Percentage = ""
        While 1
            $line = StderrRead($Output)
            If @error = -1 Then ExitLoop
            $Line = StringStripWS($line, 1)
            if StringInStr($Line, "%") Then
                $SetPercentage = StringTrimRight($Line, (StringLen($Line) - 2))
                ProgressSet($SetPercentage)
            EndIf
            $Totalerr = $Totalerr & $line & @CRLF
        Wend
        ProgressOff( )
        $finished = msgbox(4, "Finished", "The ISO file has been created as " & $TargetB & @CRLF & @CRLF & "Would you like to open this location now?")
        if $finished = 6 then
            Run("Explorer.exe " & $TargetD)
            Exit
        EndIf
    EndIf
    
    if $msg = $GUI_EVENT_CLOSE Then Exit
    if $msg = $BTNClose then Exit
WEnd
Edited by MikeOsdx
Link to comment
Share on other sites

runwait(@ComSpec & " /c " & @TempDir & "\mkisofs -o " & $TargetB & " -J -R " & $SourceB, @TempDir, @SW_HIDE)

Darn. I was hoping you would have used the StdIO redirection features in the AutoIt 3.1.0++ beta to create a progress meter GUI. :)

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

:)

Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Link to comment
Share on other sites

Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Link to comment
Share on other sites

  • 2 months later...

runwait(@ComSpec & " /c " & @TempDir & "\mkisofs -o " & $TargetB & " -J -R " & $SourceB, @TempDir, @SW_HIDE)

Darn.  I was hoping you would have used the StdIO redirection features in the AutoIt 3.1.0++ beta to create a progress meter GUI. :(

<{POST_SNAPBACK}>

Now that I am using the AutoIT Beta I thought I would try the StdoutRead using this script. Problem is that it does not seem to recognize anything from the program. Is there anyone out there that could give me some pointers? it's possible that this does not use the Standard output since it's a Linux program being run using a conversion dll file.

Mike

Link to comment
Share on other sites

Maybe it is using STDERR.  If this is the case, you maybe able to do this:

mkisofs.exe -options etc. 2>&1

The 2>&1 redirects STDERR to STDOUT.  This should work under XP and 2000.

-John

<{POST_SNAPBACK}>

That didn't seem to do anything. I am using some sample code I got from this site to test with. I think DaveF posted the origional code. I just put in the CD-Burning line to test.

; Script generated by AutoBuilder 0.5 Prototype

#include <GuiConstants.au3>

;If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("STDIO Window", 425, 322,(@DesktopWidth-425)/2, (@DesktopHeight-362)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

; Create a read-only edit control
$eOutput = GuiCtrlCreateEdit("", 0, 10, 423, 260, BitOR($ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_READONLY))
; Exit button
$bExit = GuiCtrlCreateButton("Exit", 340, 285, 60, 20)

GuiSetState()
; Run child process and provide console i/o for it.
; Parameter of 2 = provide standard output
;$ourProcess = Run("ping autoitscript.com", @SystemDir, @SW_HIDE, 2)
$ourProcess = run(@ComSpec & " /k mkisofs -o x:\isofile\test1.iso -J -R -Vtest1 x:\isotst 2>&1", @TempDir, @SW_HIDE)

; Loop and update the edit control unitl we hit EOF (and get an error)
While 1
   If $ourProcess Then
     ; Calling StdoutRead like this returns the characters waiting to be read
      $charsWaiting = StdoutRead($ourProcess, 0 , 1)
      If @error = -1 Then
         $ourProcess = 0
            MsgBox(0, "App Exited", "Process has exited...")
         ContinueLoop
      EndIf
      If $charsWaiting Then
         $currentRead = StdoutRead($ourProcess)
         GUICtrlSetData($eOutput, $currentRead, 1)
      EndIf
   EndIf
   $msg = GuiGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE
         ExitLoop
      Case $msg = $bExit
         ExitLoop
      Case Else
       ;;;
   EndSelect
WEnd
Exit
Link to comment
Share on other sites

You're not using the fourth parameter to Run, Mike.

; Run child process and provide console i/o for it.

; Parameter of 2 = provide standard output

;$ourProcess = Run("ping autoitscript.com", @SystemDir, @SW_HIDE, 2)

$ourProcess = run(@ComSpec & " /k mkisofs -o x:\isofile\test1.iso -J -R -Vtest1 x:\isotst 2>&1", @TempDir, @SW_HIDE);<-- No 4th param

Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Link to comment
Share on other sites

Thanks Dave,

I finally had some free time again so I revisited this script. I modified the code in the origional post with the StderrRead which now gives a pretty nifty and acurate progress screen. I think I finally understand the STD stuff. :(

Mike

Link to comment
Share on other sites

Awesome. Enjoy!

Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

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