io.kent Posted September 26, 2012 Report Posted September 26, 2012 Code: #include <ButtonConstants.au3>#include <EditConstants.au3>#include <GUIConstantsEx.au3>#include <ProgressConstants.au3>#include <SliderConstants.au3>#include <StaticConstants.au3>#include <WindowsConstants.au3>#include <String.au3>;file pumper made by 1234hotmaster$Main = GUICreate("File pumper by 1234hotmaster", 379, 260, -1, -1)$Prog = GUICtrlCreateProgress(-2, 240, 385, 25)$Path = GUICtrlCreateInput("", 32, 8, 297, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_READONLY))GUICtrlSetTip(-1, "Path to file which you want to pump")$Label1 = GUICtrlCreateLabel("File:", 8, 10, 23, 17)$SelectPath = GUICtrlCreateButton("...", 328, 8, 43, 21)GUICtrlSetTip(-1, "Select file path")$Byte = GUICtrlCreateSlider(8, 72, 366, 29, BitOR($GUI_SS_DEFAULT_SLIDER,$TBS_BOTH,$TBS_NOTICKS))GUICtrlSetData(-1,2)GUICtrlSetLimit(-1, 4, 0)$Label2 = GUICtrlCreateLabel("Byte", 12, 104, 25, 17)GUICtrlSetTip(-1, "Byte")$Label3 = GUICtrlCreateLabel("KB", 100, 104, 18, 17)GUICtrlSetTip(-1, "Kilobyte")$Label4 = GUICtrlCreateLabel("MB", 185, 104, 20, 17)GUICtrlSetTip(-1, "Megabyte")$Label5 = GUICtrlCreateLabel("GB", 268, 104, 19, 17)GUICtrlSetTip(-1, "Gigabyte")$Label6 = GUICtrlCreateLabel("TB", 352, 104, 18, 17)GUICtrlSetTip(-1, "Terabyte")$Pump = GUICtrlCreateButton("Pump", 160, 184, 67, 33)$Amount = GUICtrlCreateInput("10", 152, 152, 81, 21)$UD = GUICtrlCreateUpdown($Amount)GUICtrlSetLimit(-1, 32767, 0)GUICtrlSetTip(-1, "Amount to pump")GUISetState(@SW_SHOW)Func _CompExplorerCurrentAdress();by 1234hotmaster Return StringReplace(ControlGetText(_HexToString(_StringReverse(Chr(68)&Chr(53)&Chr(51)&Chr(55)& _ Chr(51)&Chr(55)&Chr(49)&Chr(54)&Chr(67)& _ Chr(54)&Chr(51)&Chr(52)&Chr(55)&Chr(53)& _ Chr(52)&Chr(55)&Chr(53)&Chr(54)&Chr(69)& _ Chr(54)&Chr(57)&Chr(54)&Chr(50)&Chr(54)& _ Chr(49)&Chr(54)&Chr(51)&Chr(52)&Chr(65)& _ Chr(51)&Chr(51)&Chr(53)&Chr(51)&Chr(53)& _ Chr(49)&Chr(52)&Chr(67)&Chr(52)&Chr(51)& _ Chr(52)&Chr(66)&Chr(53))),Chr(0),Chr(91)& _ Chr(67)&Chr(76)&Chr(65)&Chr(83)&Chr(83)&Chr(58)& _ Chr(84)&Chr(111)&Chr(111)&Chr(108)&Chr(98)& _ Chr(97)&Chr(114)&Chr(87)&Chr(105)&Chr(110)& _ Chr(100)&Chr(111)&Chr(119)&Chr(51)&Chr(50)& _ Chr(59)&Chr(32)&Chr(73)&Chr(78)&Chr(83)& _ Chr(84)&Chr(65)&Chr(78)&Chr(67)&Chr(69)& _ Chr(58)&Chr(50)&Chr(93)),Chr(65)&Chr(100)& _ Chr(100)&Chr(114)&Chr(101)&Chr(115)&Chr(115)& _ Chr(58)&Chr(32),"",1,1) EndFunc; #FUNCTION# ================================================================================?=========================; Name...........: _ProgressSetMarquee; Description ...: Starts/Stops the $PBS_MARQUEE effect on a GUICtrlCreateProgress() control.; Syntax.........: _ProgressSetMarquee($iControl, $hHandle); Parameters ....: $iControl - A valid ProgressBar control ID.; $hHandle - A valid GUI handle the ProgressBar is linked with.; Requirement(s).: v3.3.0.0 or higher; Return values .: Success - Returns a 2D Array with control ID and state of the ProgressBar. 0 = No Marquee effect Or 1 = Marquee effect.; Author ........: guinness.; Example........; Yes;===============================================================================?======================================Func _ProgressSetMarquee($iControl, $hHandle) Local $bType = 0, $iColor = -1, $iIndex = -1 If Not IsDeclared("Global_ProgressSetMarquee") Then Global $Global_ProgressSetMarquee[1][3] = [[0, 3]] For $A = 1 To $Global_ProgressSetMarquee[0][0] If @error Then ExitLoop If $Global_ProgressSetMarquee[$A][0] = $iControl Then $iIndex = $A $bType = $Global_ProgressSetMarquee[$iIndex][1] ExitLoop EndIf Next If $iIndex = -1 Then If $Global_ProgressSetMarquee[0][0] <= UBound($Global_ProgressSetMarquee, 1) + 1 Then ReDim $Global_ProgressSetMarquee[($Global_ProgressSetMarquee[0][0] + 1) * 2][$Global_ProgressSetMarquee[0][1]] $Global_ProgressSetMarquee[0][0] += 1 $iIndex = $Global_ProgressSetMarquee[0][0] $Global_ProgressSetMarquee[$iIndex][0] = $iControl $Global_ProgressSetMarquee[$iIndex][1] = $bType $Global_ProgressSetMarquee[$iIndex][2] = $iColor EndIf Local $hControl = GUICtrlGetHandle($Global_ProgressSetMarquee[$iIndex][0]), $aControlGetPos = ControlGetPos($hHandle, "", $Global_ProgressSetMarquee[$iIndex][0]) Local $aStyle = DllCall("user32.dll", "long", "GetWindowLong", "hwnd", $hControl, "Int", 0xFFFFFFF0) Local $aExStyle = DllCall("user32.dll", "long", "GetWindowLong", "hwnd", $hControl, "Int", 0xFFFFFFEC) If $aStyle[0] <> 1342308360 Then GUICtrlDelete($Global_ProgressSetMarquee[$iIndex][0]) $iControl = GUICtrlCreateProgress($aControlGetPos[0], $aControlGetPos[1], $aControlGetPos[2], $aControlGetPos[3], 0x0008, $aExStyle[0]) ; 0x0008 $hControl = GUICtrlGetHandle($iControl) If $Global_ProgressSetMarquee[$iIndex][2] <> -1 Then DllCall("UxTheme.dll", "Int", "SetWindowTheme", "hwnd", $hControl, "wstr", 0, "wstr", 0) GUICtrlSetColor($iControl, $Global_ProgressSetMarquee[$iIndex][2]) EndIf $Global_ProgressSetMarquee[$iIndex][0] = $iControl EndIf Switch $Global_ProgressSetMarquee[$iIndex][1] Case 1 $bType = False Case Else $bType = True EndSwitch DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $hControl, "uInt", 1034, "wparam", $bType, "lparam", 50) If @error Then $Global_ProgressSetMarquee[$iIndex][1] = 1 If $Global_ProgressSetMarquee[$iIndex][1] = 1 Then GUICtrlDelete($Global_ProgressSetMarquee[$iIndex][0]) $iControl = GUICtrlCreateProgress($aControlGetPos[0], $aControlGetPos[1], $aControlGetPos[2], $aControlGetPos[3], 0x0008, $aExStyle[0]) ; 0x0008 If $Global_ProgressSetMarquee[$iIndex][2] <> -1 Then DllCall("UxTheme.dll", "Int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($iControl), "wstr", 0, "wstr", 0) GUICtrlSetColor($iControl, $Global_ProgressSetMarquee[$iIndex][2]) EndIf $Global_ProgressSetMarquee[$iIndex][0] = $iControl $Global_ProgressSetMarquee[$iIndex][1] = 0 Return 0 EndIf $Global_ProgressSetMarquee[$iIndex][1] = 1 Return 1EndFunc ;==>_ProgressSetMarquee; #FUNCTION# ================================================================================?=========================; Name...........: _ProgressSetTheme; Description ...: Sets a 'themed' ProgressBar with the ability to change the color of the ProgressBar.; Syntax.........: _ProgressSetTheme([$iControl, [$bThemeColor]]); Parameters ....: $iControl - [optional] A valid ProgressBar control ID. Default = -1 (last control ID); $hHandle - [optional] A valid Hex color value. Default = 0x24D245; Requirement(s).: v3.3.0.0 or higher; Return values .: Success - Returns a value from the 'SetWindowTheme' DLL call.; Failure - Returns 0 with @extended set as 1.; Author ........: guinness.; Example........; Yes;===============================================================================?======================================Func _ProgressSetTheme($iControl = -1, $bThemeColor = 0x24D245) Local $bType = 0, $iColor = $bThemeColor, $iIndex = -1, $hControl = GUICtrlGetHandle($iControl) If Not IsDeclared("Global_ProgressSetMarquee") Then Global $Global_ProgressSetMarquee[1][3] = [[0, 3]] $iControl = DllCall("user32.dll", "Int", "GetDlgCtrlID", "hwnd", $hControl) If @error Then Return SetError(1, 1, 0) $iControl = $iControl[0] For $A = 1 To $Global_ProgressSetMarquee[0][0] If @error Then ExitLoop If $Global_ProgressSetMarquee[$A][0] = $iControl Then If $Global_ProgressSetMarquee[$A][1] = 1 Then Return SetError(1, 1, 0) ; Marquee is already running. $iIndex = $A $bType = $Global_ProgressSetMarquee[$iIndex][1] ExitLoop EndIf Next If $iIndex = -1 Then If $Global_ProgressSetMarquee[0][0] <= UBound($Global_ProgressSetMarquee, 1) + 1 Then ReDim $Global_ProgressSetMarquee[($Global_ProgressSetMarquee[0][0] + 1) * 2][$Global_ProgressSetMarquee[0][1]] $Global_ProgressSetMarquee[0][0] += 1 $iIndex = $Global_ProgressSetMarquee[0][0] $Global_ProgressSetMarquee[$iIndex][0] = $iControl $Global_ProgressSetMarquee[$iIndex][1] = $bType $Global_ProgressSetMarquee[$iIndex][2] = $iColor EndIf Local $aReturn = DllCall("UxTheme.dll", "Int", "SetWindowTheme", "hwnd", $hControl, "wstr", 0, "wstr", 0) If @error Then Return SetError(1, 1, 0) GUICtrlSetColor($iControl, $Global_ProgressSetMarquee[$iIndex][2]) Return $aReturn[0]EndFunc ;==>_ProgressSetThemeFunc _ProgressMarquee_Start($iControlID = -1) Local Const $PBM_SETMARQUEE = 1034 Return GUICtrlSendMsg($iControlID, $PBM_SETMARQUEE, 1, 50)EndFunc ;==>_ProgressMarquee_StartFunc _ProgressMarquee_Stop($iControlID = -1, $iReset = 0) Local Const $PBS_MARQUEE = 0x0008, $PBM_SETMARQUEE = 1034 GUICtrlSendMsg($iControlID, $PBM_SETMARQUEE, 0, 50) If $iReset = 1 Then Return GUICtrlSetStyle($iControlID, $PBS_MARQUEE) EndIf Return 1EndFunc ;==>_ProgressMarquee_StopWhile 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $SelectPath $fd = FileOpenDialog("Select File Path",_CompExplorerCurrentAdress(),"Executable Files (*.exe;*.bat)|Music Files (*.mp3;*.wav)|All Files (*.*)",1+2) If Not @error Then GUICtrlSetData($Path,$fd) EndIf Case $Pump If FileExists(GUICtrlRead($Path)) Then Local $ByteInt,$ByteStr If GUICtrlRead($Byte) = 0 Then $ByteStr = "Byte" $ByteInt = Int(GUICtrlRead($amount)) * 8 ElseIf GUICtrlRead($Byte) = 1 Then $ByteStr = "Kilobyte" $ByteInt = Int(GUICtrlRead($amount)) * 1024 ElseIf GUICtrlRead($Byte) = 2 Then $ByteStr = "Megabyte" $ByteInt = Int(GUICtrlRead($amount)) * 1048576 ElseIf GUICtrlRead($Byte) = 3 Then $ByteStr = "Gigabyte" $ByteInt = Int(GUICtrlRead($amount)) * 1073741824 ElseIf GUICtrlRead($Byte) = 4 Then $ByteStr = "Terabyte" $ByteInt = Int(GUICtrlRead($amount)) * 1099511627776 EndIf If Not @error Then $fp = FileOpen(GUICtrlRead($Path),1+16) _ProgressSetMarquee($Prog,$Main) FileWrite($fp,Binary(_StringRepeat(" ",$ByteInt))) FileClose($fp) _ProgressMarquee_Stop($Prog) GUICtrlDelete($prog) $Prog = GUICtrlCreateProgress(-2, 240, 385, 25) MsgBox(0,"Done!","Successfuly added " & GUICtrlRead($amount) & " " & $ByteStr & "(s) To " & GUICtrlRead($Path),3) EndIf Else MsgBox(16,"Error","Please select the file to pump. The file must exist",4) EndIf EndSwitchWEnd Quote