Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoTrayIcon
- #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
- #AutoIt3Wrapper_icon=aupx.ico
- #AutoIt3Wrapper_outfile=Aupx1.0.0.2.exe
- #AutoIt3Wrapper_Compression=4
- #AutoIt3Wrapper_UseUpx=n
- #AutoIt3Wrapper_UseX64=n
- #AutoIt3Wrapper_Res_Comment=XPYRO SOFT - Mejorando el mañana
- #AutoIt3Wrapper_Res_Description=Comprime ejecutables y librerias con Apux
- #AutoIt3Wrapper_Res_Fileversion=1.0.0.2
- #AutoIt3Wrapper_Res_LegalCopyright=XPYRO SOFT
- #AutoIt3Wrapper_Res_Language=2058
- #AutoIt3Wrapper_Res_Field=CompanyName|http://softx.comxa.com/
- #AutoIt3Wrapper_Res_Field=ProductName|Aupx
- #AutoIt3Wrapper_Res_Field=ProductVersion|1.0.0.2
- #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
- #include-once
- #include <ButtonConstants.au3>
- #include <ComboConstants.au3>
- #include <GUIConstantsEx.au3>
- #include <ListViewConstants.au3>
- #include <ProgressConstants.au3>
- #include <StaticConstants.au3>
- #include <WindowsConstants.au3>
- #include <GuiListView.au3>
- #include <Misc.au3>
- If Not FileExists(@ScriptDir & '\upx.exe') Then
- MsgBox(8240, "Aupx 1.0.0.2", "No se encuentra el ejecutable upx.exe en la carpeta upx")
- Exit
- EndIf
- ;Si ya estoy corriendo, cerrarme
- _Singleton('28aupx1022')
- $Cerrar = 0
- $Ver = "1.0.0.2"
- $Form1 = GUICreate('Aupx ' & $Ver, 483, 354, -1, -1, -1, $WS_EX_ACCEPTFILES)
- $ListView1 = GUICtrlCreateListView('Ruta de archivos:|Salida:', 0, 40, 482, 240, -1 , $WS_EX_ACCEPTFILES)
- GUICtrlSetState(-1, $GUI_DROPACCEPTED)
- GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 310)
- GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 150)
- $Button1 = GUICtrlCreateButton('Añadir archivo', 8, 8, 107, 25)
- $Button3 = GUICtrlCreateButton('Limpiar lista', 232, 8, 91, 25)
- GUICtrlSetState(-1, $GUI_DISABLE)
- $Button4 = GUICtrlCreateButton('Acerca de', 328, 8, 83, 25)
- $Button5 = GUICtrlCreateButton('Salir', 416, 8, 59, 25)
- $Button6 = GUICtrlCreateButton('>> Iniciar <<', 8, 296, 107, 41)
- GUICtrlSetState(-1, $GUI_DISABLE)
- $Checkbox1 = GUICtrlCreateCheckbox('Crear copia de respaldo', 344, 312, 129, 17)
- GUICtrlSetState(-1, $GUI_CHECKED)
- GUICtrlCreateGroup('Opción:', 128, 288, 97, 57)
- $Radio1 = GUICtrlCreateRadio('Comprimir', 136, 304, 65, 17)
- GUICtrlSetState(-1, $GUI_CHECKED)
- $Radio2 = GUICtrlCreateRadio('Descomprimir', 136, 320, 81, 17)
- GUICtrlCreateGroup('', -99, -99, 1, 1)
- GUICtrlCreateGroup('Compresión:', 240, 288, 89, 57)
- $Combo1 = GUICtrlCreateCombo('', 248, 312, 73, 25)
- GUICtrlSetData(-1, '--best|-9|-8|-7|-6|-5|-4|-3|-2|-1', '--best')
- GUICtrlCreateGroup('', -99, -99, 1, 1)
- GUISetState(@SW_SHOW)
- While 1
- $nMsg = GUIGetMsg()
- Switch $nMsg
- Case $GUI_EVENT_CLOSE, $Button5
- _Salir()
- Case $Button1
- $Archivo = FileOpenDialog('añadir archivo(s) a la lista', '', 'ejecutables (*.exe)|archivos dll (*.dll)', 7, '', $Form1)
- If Not @error Then
- GUICtrlSetState($Button6, $GUI_ENABLE)
- GUICtrlSetState($Button3, $GUI_ENABLE)
- $Arc = StringSplit($Archivo, '|') ;Divido en variables la ruta dependiendo de '|'
- If $Arc[0] <> 1 Then ;Si el valos es diferente a 1 entonces
- For $N = 2 To $Arc[0] ;Añadir barios archivos
- $bar = StringReplace($Arc[1] & '\' & $Arc[$N], '\\', '\')
- $Repeat = _GUICtrlListView_FindText($ListView1, $bar)
- If $Repeat = -1 Then
- _GUICtrlListView_AddItem($ListView1, $bar)
- Else
- MsgBox(8240, 'Aupx ' & $Ver, 'El archivo ya se encuentra en la lista' & @CRLF & @CRLF & $bar)
- EndIf
- Next
- Else
- $Repeat = _GUICtrlListView_FindText($ListView1, $Archivo)
- If $Repeat = -1 Then
- _GUICtrlListView_AddItem($ListView1, $Archivo)
- Else
- MsgBox(8240, 'Aupx ' & $Ver, 'El archivo ya se encuentra en la lista' & @CRLF & @CRLF & $Archivo)
- EndIf
- EndIf
- EndIf
- Case $Button3 ;limpiar lista
- $Eliminarlista = MsgBox(8228, 'Aupx ' & $Ver, '¿Seguro que desea eliminar todos los archivos de la lista?')
- If $Eliminarlista = 6 Then
- GUICtrlDelete($ListView1)
- GUICtrlSetState($Button6, $GUI_DISABLE)
- GUICtrlSetState($Button3, $GUI_DISABLE)
- $ListView1 = GUICtrlCreateListView('Ruta de archivos:|Salida:', 0, 40, 482, 240, -1 , $WS_EX_ACCEPTFILES)
- GUICtrlSetState(-1, $GUI_DROPACCEPTED)
- GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 310)
- GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 150)
- EndIf
- Case $Button4
- GUISetState(@SW_DISABLE, $Form1)
- _Acercade()
- Case $Button6
- $Cerrar = 1
- GUICtrlSetData($Button6, 'Parar Todo')
- GUICtrlSetState($Button1, $GUI_DISABLE)
- GUICtrlSetState($Button3, $GUI_DISABLE)
- GUICtrlSetState($Button4, $GUI_DISABLE)
- GUICtrlSetState($Button5, $GUI_DISABLE)
- GUICtrlSetState($Radio1, $GUI_DISABLE)
- GUICtrlSetState($Radio2, $GUI_DISABLE)
- GUICtrlSetState($Combo1, $GUI_DISABLE)
- GUICtrlSetState($Checkbox1, $GUI_DISABLE)
- _Comprimir(0)
- $Cerrar = 0
- GUICtrlSetData($Button6, '>> Iniciar <<')
- GUICtrlSetState($Button1, $GUI_ENABLE)
- GUICtrlSetState($Button3, $GUI_ENABLE)
- GUICtrlSetState($Button4, $GUI_ENABLE)
- GUICtrlSetState($Button5, $GUI_ENABLE)
- GUICtrlSetState($Radio1, $GUI_ENABLE)
- GUICtrlSetState($Radio2, $GUI_ENABLE)
- If BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) Then
- GUICtrlSetState($Combo1, $GUI_ENABLE)
- GUICtrlSetState($Checkbox1, $GUI_ENABLE)
- EndIf
- $Terminado = MsgBox(8260, 'Aupx ' & $Ver, 'Terminado el proceso de archivos.' & @CRLF & @CRLF & '¿Desea eliminar archivos procesados de la lista?')
- If $Terminado = 6 Then
- GUICtrlDelete($ListView1)
- GUICtrlSetState($Button6, $GUI_DISABLE)
- GUICtrlSetState($Button3, $GUI_DISABLE)
- $ListView1 = GUICtrlCreateListView('Ruta de archivos:|Salida:', 0, 40, 482, 240, -1 , $WS_EX_ACCEPTFILES)
- GUICtrlSetState(-1, $GUI_DROPACCEPTED)
- GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 310)
- GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 150)
- EndIf
- Case $Radio1
- GUICtrlSetState($Combo1, $GUI_ENABLE)
- GUICtrlSetState($Checkbox1, $GUI_ENABLE)
- Case $Radio2
- GUICtrlSetState($Combo1, $GUI_DISABLE)
- GUICtrlSetState($Checkbox1, $GUI_DISABLE)
- Case $GUI_EVENT_DROPPED
- $Ifexe = StringSplit(@GUI_DragFile, '.')
- If $Ifexe[$Ifexe[0]] = "exe" Or $Ifexe[$Ifexe[0]] = "dll" Then
- $Repeat = _GUICtrlListView_FindText($ListView1, @GUI_DragFile)
- If $Repeat = -1 Then
- _GUICtrlListView_AddItem($ListView1, @GUI_DragFile)
- Else
- MsgBox(8240, 'Aupx ' & $Ver, 'El archivo ya se encuentra en la lista' & @CRLF & @CRLF & @GUI_DragFile)
- EndIf
- GUICtrlSetState($Button6, $GUI_ENABLE)
- GUICtrlSetState($Button3, $GUI_ENABLE)
- Else
- MsgBox(8240, 'Aupx ' & $Ver, 'El archivo no es un ejecutable PE' & @CRLF & @CRLF & @GUI_DragFile)
- EndIf
- EndSwitch
- WEnd
- Func _Acercade()
- $Form2 = GUICreate('Acerca de', 329, 296, -1, -1, BitOR($WS_CAPTION, $WS_SYSMENU), $WS_EX_TOOLWINDOW, $Form1)
- GUICtrlCreateIcon(@ScriptFullPath, 99, 99, 10, 128, 128, BitOR($SS_NOTIFY, $WS_GROUP))
- GUICtrlCreateLabel('Aupx ' & $Ver, 76, 145, 177, 33)
- GUICtrlSetFont(-1, 18, 800, 0, 'Verdana')
- GUICtrlCreateLabel('Comprime ejecutables y librerias con Aupx', 62, 180, 254, 17)
- GUICtrlCreateLabel('© 2008 - 2010 XPYRO SOFT', 95, 200, 145, 17)
- $Link = GUICtrlCreateLabel('http://softx.comxa.com/', 105, 230, 119, 17)
- GUICtrlSetColor(-1, 0x0000FF)
- GUICtrlSetCursor(-1, 0)
- $2Button1 = GUICtrlCreateButton('Aceptar', 77, 255, 175, 25)
- GUISetState(@SW_SHOW, $Form2)
- Do
- $GMsg = GUIGetMsg()
- If $GMsg = $Link Then ShellExecute('http://softx.comxa.com/')
- Sleep(10)
- Until $GMsg = $GUI_EVENT_CLOSE Or $GMsg = $2Button1
- GUISetState(@SW_ENABLE, $Form1)
- GUIDelete($Form2)
- EndFunc ;==>_Acercade
- Func _Comprimir($fIndex)
- $ItemTotal = _GUICtrlListView_GetItemCount($ListView1)
- If $fIndex <= $ItemTotal Then
- _GUICtrlListView_AddSubItem($ListView1, $fIndex, 'Trabajando espere...', 1)
- $Ejecutable = _GUICtrlListView_GetItemText($ListView1, $fIndex)
- $size = FileGetSize($Ejecutable)
- If BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) Then
- If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) Then $Respaldo = ' -k '
- If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) <> $GUI_CHECKED Then $Respaldo = ' '
- ShellExecute('upx.exe', GUICtrlRead($Combo1) & $Respaldo & '"' & $Ejecutable & '"', @ScriptDir & '', 'open', @SW_HIDE)
- ElseIf BitAND(GUICtrlRead($Radio2), $GUI_CHECKED) Then
- ShellExecute('upx.exe', '-d ' & '"' & $Ejecutable & '"', @ScriptDir & '', 'open', @SW_HIDE)
- EndIf
- Do
- $nMsg = GUIGetMsg()
- If $nMsg = $Button6 Then ProcessClose('upx.exe')
- If Not ProcessExists('upx.exe') Then
- $Size2 = FileGetSize($Ejecutable)
- If $size = $Size2 Then
- _GUICtrlListView_AddSubItem($ListView1, $fIndex, 'Sin cambios en el archivo', 1)
- Else
- _GUICtrlListView_AddSubItem($ListView1, $fIndex, 'Nuevo tamaño ' & Round($Size2 / 1024, 1) & ' KB', 1)
- EndIf
- $nMsg = $Button6
- _Comprimir($fIndex + 1)
- EndIf
- Sleep(5)
- Until $nMsg = $Button6
- EndIf
- EndFunc ;==>_Comprimir
- Func _Salir()
- If $Cerrar = 0 Then Exit
- EndFunc ;==>_Salir
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement