Shadowpp Posted October 4, 2007 Share Posted October 4, 2007 Here is my code.... expandcollapse popup#NoTrayIcon #include <GUIConstants.au3> #Include <GuiListView.au3> #include <GuiList.au3> #include <INet.au3> Opt("ExpandVarStrings", 1) $Form1 = GUICreate("BITS file transfer request utility", 351, 186, -1, -1, -1, $WS_EX_ACCEPTFILES) $searchinput = GUICtrlCreateInput("", 8, 9, 209, 21) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUISetState() $searchbutton = GUICtrlCreateButton("Add File(s)", 224, 8, 80, 25) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $clear_all = GUICtrlCreateButton("Clear All", 130, 160, 89, 25, 0) $clear_selected = GUICtrlCreateButton("Clear Selected", 7, 160, 89, 25, 0) $ListView1 = GUICtrlCreateListView("File Name", 8, 40, 335, 121, $LVS_SORTASCENDING, $LVS_EX_FULLROWSELECT + $LVS_EX_GRIDLINES) _GUICtrlListViewSetColumnWidth($ListView1, 0, 332) $launchButton = GUICtrlCreateButton("Make Cab(s)", 255, 160, 89, 25) GUISetState(@SW_SHOW) While 1 $hGui = GUIGetMsg() Switch $hGui Case $GUI_EVENT_CLOSE Exit Case $clear_selected _GUICtrlListViewDeleteItemsSelected($ListView1) Case $clear_all _GUICtrlListViewDeleteAllItems($ListView1) Case $searchbutton $Val = GUICtrlRead($searchinput) If $Val = "" Then $MyDocsFolder = "::{450D8FBA-AD25-11D0-98A8-0800361B1103}" $FileName = FileSaveDialog("Select the file you wish to compress", $MyDocsFolder, "All Files (*.*)", 2) If $FileName <> "" Then GUICtrlCreateListViewItem($FileName, $ListView1) EndIf Else GUICtrlCreateListViewItem($Val, $ListView1) GUICtrlSetData($searchinput, "") EndIf Case $launchButton $ItemCount = _GUICtrlListViewGetItemCount($ListView1) ProgressOn("Please Wait..", "Creating CAB files") For $x = 0 To $ItemCount - 1 _GUICtrlListViewSetItemSelState($ListView1, $x) $Text = _GUICtrlListViewGetItemText($ListView1, $x) $String = StringSplit($Text, '\', 1) $String1 = StringSplit($String[$String[0]], '.', 1) $String2 = $String1[$String1[0] - 1] Run("makecab ""$text$"" ""H:\" & $String2 & ".cab""", "", @SW_HIDE) While ProcessExists("makecab.exe") For $i = 10 To 100 Step 10 Sleep(1000) ProgressSet($i, "This may take several minutes to complete.") Next WEnd Next ProgressOff() _INetMail("nta4test", "New CAB files ready for store distribution", "New CAB files are in my H:\ drive which ready to be distributed to the stores.") Exit EndSwitch WEnd Any tips on how to make this code smaller / faster / better would be appreciated. Link to comment Share on other sites More sharing options...
qazwsx Posted October 4, 2007 Share Posted October 4, 2007 you could make it samller if u got rid of guiconstants 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