• 欢迎访问奇跡の海网站,本站不上传任何资源,所有资源均来自于网络,欢迎加入奇跡の海~!奇跡の海-WordPress QQ群
  • 本站下载资源为网络上收集整理而来,并且以计算机技术研究交流为目的,版权归原作者所有,仅供大家参考,学习,不存在任何商业目的与商业用途.
  • 本站系统镜像均来自于官方原版,ed2k可视为P2P下载链接。所有操作系统默认均为试用版,如有正版密钥可以有效激活,本站不提供任何激活和相关服务。

AU3源码可删除文本文档的重复行,也可删除难以清除的文件

AutoIT3 奇跡の海 2年前 (2017-06-23) 628次浏览 已收录 0个评论 扫描二维码

AU3源码可删除文本文档的重复行,也可删除难以清除的文件

简介

可删除文本文档的重复行,也可删除难以清除的文件删除文本重复行,750M只要五分钟!

源码

#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_Icon=F:\1\nbm\好看的桌面\美化工具\ForlderSet\5000个ICO图标文件\fuku\stuff.ico
#AutoIt3Wrapper_Res_Comment=可删除文本文档的重复行,也可删除难以清除的文件!
#AutoIt3Wrapper_Res_FileVersion=0.0.0.0
#AutoIt3Wrapper_Run_Tidy=y
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <File.au3>

$Skin_dll = @TempDir & "\Skin.dll"
$Skin_she = @TempDir & "\aero.she"

FileInstall("Skin.dll", $Skin_dll)
FileInstall("aero.she", $Skin_she)

$new = "删除重复行.TXT"

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("清除重复行  QQ:86942551 11.15/2010", 386, 151, -1, -1, -1, $WS_EX_ACCEPTFILES)
Skin($Skin_dll, $Skin_she)
GUICtrlCreateGroup("请把文件或文件夹拖入框内,文本文档可清除重复行", 8, 3, 369, 93)
$Input1 = GUICtrlCreateInput("", 16, 16, 353, 70, $ES_AUTOHSCROLL + $WS_DISABLED)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("清除重复行", 141, 104, 105, 33)
$Button2 = GUICtrlCreateButton("清除顽固文件", 266, 104, 105, 33)

$Checkbox1 = GUICtrlCreateCheckbox("代替源文件", 19, 100, 97, 17)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x804040)
$Label1 = GUICtrlCreateLabel("分割", 8, 126, 28, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Input2 = GUICtrlCreateInput("", 36, 120, 33, 24, BitOR($ES_AUTOHSCROLL, $ES_NUMBER))
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("M每个文件", 72, 126, 63, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        GUISetState(@SW_HIDE, $Form1)
                        Exit
                Case $Button1
                        $ofile = GUICtrlRead($Input1)
                        $SIZE = FileGetSize(StringTrimLeft($ofile, StringInStr($ofile, "\", 0, -1))) / 1024 / 1024
                        If $SIZE = 0 Then MsgBox(16, "提示", "请把本软件与要清除重复行文件放在一个目录下")
                        If $SIZE <= 30 And $SIZE > 0 Then
                                If MsgBox(4, "提示", "确认开始清除重复行", 10) = 6 Then _filedelline($ofile, GUICtrlRead($Checkbox1))
                        EndIf
                        If $SIZE > 30 Then
                                If MsgBox(4, "提示", "拆分过程中会在当目标生成:" & GUICtrlRead($Input2) & "M 的小文件多个文件" & @CRLF & "之后会自动删除" & @CRLF & "确认开始清除重复行", 10) = 6 Then _aaa()
                        EndIf
                Case $Button2
                        $scname = '"' & GUICtrlRead($Input1) & '"'
                        If Not StringInStr($scname, "&")   And $scname <> '""' Then
                                RunWait(@ComSpec & ' /c DEL /F /A /Q ' & $scname, '', @SW_HIDE)
                                RunWait(@ComSpec & ' /c RD /S /Q ' & $scname, '', @SW_HIDE)
                        Else
                                MsgBox(16, "提示", "该类文件不能使用该程序删除否则会出错")
                        EndIf
        EndSwitch
WEnd

Func _filedelline($aFile, $_ab)

        Local $str = '', $file_array
        _FileReadToArray($aFile, $file_array)

        If @error = 1 Or @error = 2 Then
                MsgBox(16, "提示", "打开文件出错")
                GUISetState(@SW_HIDE, $Form1)
                Exit
        EndIf
        $begin = TimerInit()
        For $i = 1 To UBound($file_array) - 1
                $temp = $file_array[$i]
                If Not IsDeclared($temp) Then
                        Assign($temp, $i)
                        If $temp <> "" Then $str &= $temp & @CRLF
                        
                EndIf
        Next

        $dif = TimerDiff($begin)
        If $_ab = 4 Then
                FileWrite($new, $str)
                MsgBox(0, "提示", "删除重复行完成,用时:" & $dif / 1000 & '秒' & @CRLF & "新内容为当前目录下的" & @CRLF & "删除重复行.TXT")
        Else
                FileDelete($aFile)
                FileWrite($aFile, $str)
                MsgBox(0, "提示", "删除重复行完成,用时:" & $dif / 1000 & '秒')
        EndIf
EndFunc   ;==>_filedelline

Func Skin($Skin_dll, $Skin_she)
        $Dll = DllOpen($Skin_dll)
        DllCall($Dll, "int", "SkinH_AttachEx", "str", $Skin_she, "str", "mhgd")
        DllCall($Dll, "int", "SkinH_SetAero", "int", 1)
EndFunc   ;==>Skin


Func _aaa()
        $file = GUICtrlRead($Input1) ;文件路径
        $m = GUICtrlRead($Input2)
        If 50 >= $m And $m >= 10 Then
                $name = StringTrimLeft($file, StringInStr($file, "\", 0, -1)) ;要拆的文件名
                $name_array = ""
                $new = "删除重复行.TXT"

                $begin2 = TimerInit()
                $folder = @TempDir & "\dsk" ;临时路径
                If FileExists($folder) Then DirRemove($folder, 1)
                DirCreate($folder)
                FileInstall("split.exe", $folder & "\split.exe") ;安装文件
                ShellExecuteWait($folder & "\split.exe", "-a2 -b" & $m & "m" & " " & $name & " " & $name & "_", "", "", @SW_HIDE)
                ;Split -a2   -b10m     data.mpg            data.mpg__命令拆分

                $CHR = "abcdefghijklmnopqrstuvwxyz"
                $CNT = 0
                For $i = 1 To 26
                        For $j = 1 To 26
                                $AB = StringMid($CHR, $i, 1) & StringMid($CHR, $j, 1)
                                If FileExists($name & "_" & $AB) Then
                                        $CNT += 1
                                        If $CNT < 10 Then $QD = "00"
                                        If $CNT >= 10 And $CNT < 100 Then $QD = "0"
                                        If $CNT >= 100 Then $QD = ""
                                        FileMove($name & "_" & $AB, $folder & "\" & $name & $QD & $CNT & StringRight($name, 4), 9) ;新文件名
                                        _filedelline2($folder & "\" & $name & $QD & $CNT & StringRight($name, 4))
                                        

                                Else
                                        ExitLoop
                                EndIf
                        Next
                Next
                If GUICtrlRead($Checkbox1) = 4 Then
                        _filedelline2($new)
                Else
                        FileDelete($file)
                        _filedelline2($new)
                        FileMove($new, $file)
                EndIf
                DirRemove($folder, 1)
                $dif2 = TimerDiff($begin2)
                MsgBox(0, "提示", "删除重复行完成," & @CRLF & @CRLF & "用时:" & $dif2 / 1000 & "秒")
        Else
                MsgBox(0, "提示", "请填写文件拆分大小," & @CRLF & @CRLF & "文件拆分范围:10M--50M" & @CRLF & @CRLF & "建议: 30M")
        EndIf
EndFunc   ;==>_aaa

Func _filedelline2($aFile)
        Local $str = '', $file_array
        _FileReadToArray($aFile, $file_array)
        For $i = 1 To UBound($file_array) - 1
                $temp = $file_array[$i]
                If Not IsDeclared($temp) Then
                        Assign($temp, $i)
                        $str &= $temp & @CRLF
                EndIf
        Next
        FileDelete($aFile)
        FileWrite($new, $str)
EndFunc   ;==>_filedelline2

转自:AUTOIT CN


版权声明:本站所有文章和资源使用CC BY-NC-SA 4.0协议授权发布 , 转载应当以相同方式注明文章来自“SeaOMC.COM->AU3源码可删除文本文档的重复行,也可删除难以清除的文件!在下边可以分享本文哦!
喜欢 (0)
[]
分享 (0)
奇跡の海
关于作者:
一个WordPress菜鸟!
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址