Jump to content

Recommended Posts

Posted

When a file is added the filesize is added to the total file size of all the files included. thats what should happen... Instead it gets smaller???? how can 1.23mb + 1mb = 0.66 mb?? what the?? heres the relvant part of the code. (with the math)

$filesizecalc = FileGetSize ($file)
$filesize = Round ($filesizecalc / 1048576, 2)
$sizetotaltxt = $sizetotal + $filesize
GUICtrlSetData ($Label8, "Total Size:           " & $sizetotaltxt & " Mb")
Posted

The script you posted never declared the variable $sizetotal before you used it. Could you include the rest of the script that could help us determine what it might be?

Infinity is a floorless room without walls or ceiling.Anyone who cannot cope with mathematics is not fully human. At best he is a tolerable subhuman who has learned to wear shoes, bathe, and not make messes in the house.

Posted (edited)

The script you posted never declared the variable $sizetotal before you used it. Could you include the rest of the script that could help us determine what it might be?

Sure:

#include <GUIConstants.au3>
#include <GuiList.au3>
Dim $sizetotaltxt = 0
Dim $sizetotal = 0
Global $input
Global $Form1 = GUICreate("PDB- Installer Creator", 632, 521, 193, 115)
Global $Pic1 = GUICtrlCreatePic("", 16, 24, 120, 250, BitOR($SS_NOTIFY,$WS_GROUP))
Global $Input1 = GUICtrlCreateInput("1", 168, 81, 113, 21)
Global $Input2 = GUICtrlCreateInput("2", 168, 41, 113, 21)
Global $Input3 = GUICtrlCreateInput('3', 168, 121, 113, 21)
Global $Input4 = GUICtrlCreateInput("4", 384, 305, 233, 21)
Global $Input5 = GUICtrlCreateInput("5", 168, 161, 113, 21)
Global $Input6 = GUICtrlCreateInput("6", 168, 201, 113, 21)
Global $Label1 = GUICtrlCreateLabel("Side Picture (Acutual Size)", 168, 24, 163, 17)
Global $Label2 = GUICtrlCreateLabel("Installer Title", 168, 64, 163, 17)
Global $Label3 = GUICtrlCreateLabel("Installer Icon (32x32)", 168, 104, 163, 17)
Global $Label4 = GUICtrlCreateLabel("Title:", 352, 304, 27, 17)
Global $Label5 = GUICtrlCreateLabel("Text:", 352, 328, 28, 17)
Global $Label6 = GUICtrlCreateLabel("Defult Installation Path", 168, 144, 163, 17)
Global $Label7 = GUICtrlCreateLabel("Start Menu Deafult Name", 168, 184, 163, 17)
Global $List1 = GUICtrlCreateList("", 16, 304, 201, 149)
Global $DriveCombobox = GUICtrlCreateList("", 240, 304, 89, 84)
Global $Edit1 = GUICtrlCreateEdit("", 352, 24, 265, 241)
GUICtrlSetData(-1, "AEdit1")
Global $Edit2 = GUICtrlCreateEdit("", 352, 344, 265, 161)
GUICtrlSetData(-1, "AEdit2")
Global $Group1 = GUICtrlCreateGroup("Installer Settings:", 8, 8, 329, 273)
Global $Group2 = GUICtrlCreateGroup("Files To Install:", 8, 288, 217, 225)
Global $Group3 = GUICtrlCreateGroup("Drives to Burn to:", 232, 288, 105, 113)
Global $Group4 = GUICtrlCreateGroup("License of Software:", 344, 8, 281, 273)
Global $Group5 = GUICtrlCreateGroup("Welcome Screen Text:", 344, 288, 281, 225)
Global $Button1 = GUICtrlCreateButton("Remove", 72, 456, 57, 25, 0)
Global $Button2 = GUICtrlCreateButton("Browse", 288, 40, 41, 25, 0)
Global $Button3 = GUICtrlCreateButton("Browse", 288, 120, 41, 25, 0)
Global $Button4 = GUICtrlCreateButton("Add", 16, 456, 57, 25, 0)
Global $Button5 = GUICtrlCreateButton("Browse", 288, 160, 41, 25, 0)
Global $Button7 = GUICtrlCreateButton("Preview", 232, 408, 105, 25, 0)
Global $Button8 = GUICtrlCreateButton("Burn Protected Disc", 232, 440, 105, 41, 0)
Global $Button9 = GUICtrlCreateButton("About", 232, 488, 105, 25, 0)
Global $Label8 = GUICtrlCreateLabel("Total Size:           " & $sizetotaltxt & " Mb", 135, 456, 85, 30)
Global $Input7 = GUICtrlCreateInput("", 16, 488, 155, 21)
Global $Button10 = GUICtrlCreateButton("Browse", 174, 486, 49, 25, 0)
Global $as_drive = DriveGetDrive ("CDROM")
If Not @error = 1 Then
Local $s_ComboData
For $intcount = 1 to $as_drive[0]
    $s_ComboData &= "|"& StringUpper($as_drive[$intcount])
Next
GUICtrlSetData($DriveCombobox,StringTrimLeft($s_ComboData,1),$as_drive[1])
Else
    Msgbox(0,"ERROR","Could not get system CD and DVD drives.")
    Return 0
EndIf
GUISetState(@SW_SHOW)
While 1
    $Msg = GUIGetMsg()
    Select 
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $Button1
            $ret = _GUICtrlListDeleteItem ($list1, 1)
            If ($ret == $LB_ERR) Then
                MsgBox(16, "Error", "You must have at least 1 file to install")
            EndIf
        Case $msg = $Button2
            $pic = FileOpenDialog ( "Select Side Splash, 120x250:", "", "Images (*.jpg;*.bmp;*.gif)")
            GUICtrlSetImage ($pic1, $pic)
            GUICtrlSetData ( $Input2 ,$pic)
        Case $msg = $Button3
            FileOpenDialog ( "Select Icon, 32x32:", "", "Icons (*.ico)")
            GUICtrlSetData ( $Input2 ,$pic)
        Case $msg = $Button4
            $file = GUICtrlRead ($input7)
            $filesizecalc = FileGetSize ($file)
            $filesize = Round ($filesizecalc / 1048576, 2)
            $sizetotaltxt = $sizetotal + $filesize
            GUICtrlSetData ($Label8, "Total Size:           " & $sizetotaltxt & " Mb")
            If (StringLen(GUICtrlRead($input7)) > 0) Then
                $ret = _GUICtrlListAddItem ($list1, GUICtrlRead($input7))
                If ($ret < 0) Then
                    If ($ret == $LB_ERRSPACE) Then
                        MsgBox(16, "Error", "insufficient space to store the new strings from calling _GUICtrlListAddItem")
                    ElseIf ($ret == $LB_ERR) Then
                        MsgBox(16, "Error", "Unknown error from _GUICtrlListAddItem")
                    EndIf
                EndIf
            EndIf
            GUICtrlSetData ($Input7, "")
        Case $msg = $Button5
            $DefultInstalpth = FileSelectFolder ( "Please Select a Defult Installation Path.", "", "")
            GUICtrlSetData ( $Input5 ,$DefultInstalpth)
    Case $msg = $Button7
            GLOBAL $title = GUICtrlRead ($Input1,0)
            GLOBAL $SidePic = GUICtrlRead ($Input2,0)
            GLOBAL $icon = GUICtrlRead ($Input3,0)
            GLOBAL $wlcmTitle = GUICtrlRead ($Input4,0)
            GLOBAL $DefultInstalpth = GUICtrlRead ($Input5,0)
            GLOBAL $StartMenu = GUICtrlRead ($Input6,0)
            GLOBAL $Filelist = GUICtrlRead ($List1,0)
            GLOBAL $license = GUICtrlRead ($Edit1,0)
            GLOBAL $wlctxt = GUICtrlRead ($Edit2,0)
                Welcomescn ()
        Case $msg = $Button8
                CreateDisc ()
        Case $msg = $Button9

        Case $msg = $Button10
            $fille = FileOpenDialog ( "Select File to add to Install list:", "", "All (*.*)")
            GUICtrlSetData ( $Input7 ,$fille)
    EndSelect
WEnd

EDIT: made the code in the autoit code thingy...

Edited by bert
Posted

Okay, I think you made a mistake when you put $sizetotal instead of $sizetotaltext.

Replace: $sizetotaltxt = $sizetotal + $filesize

With: $sizetotaltxt +=$filesize

Infinity is a floorless room without walls or ceiling.Anyone who cannot cope with mathematics is not fully human. At best he is a tolerable subhuman who has learned to wear shoes, bathe, and not make messes in the house.

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
×
×
  • Create New...