找回密码
 加入
搜索
查看: 2393|回复: 7

如何用AU3扫描磁盘中的文件~~

[复制链接]
发表于 2008-11-22 17:07:47 | 显示全部楼层 |阅读模式
就和杀毒软件的形式差不多!!

谢谢~~~~
发表于 2009-4-22 13:14:28 | 显示全部楼层
学习中,先给你顶一个!
发表于 2009-4-22 20:25:48 | 显示全部楼层
提问前请先搜索一下坛论,你的问题可以参考下面这个贴子,http://www.autoitx.com/forum.php ... hlight=%B1%E9%C0%FA
发表于 2009-4-22 23:30:40 | 显示全部楼层
本帖最后由 jycel 于 2009-4-22 23:32 编辑

参照下吧!

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#NoTrayIcon
#include <EditConstants.au3>

$Form1 = GUICreate("搜索工具", 660, 352);, 191, 121)
GUISetBkColor(0xFF0000)
$List1 = GUICtrlCreateList("", 2, 8, 656, 266)
$input1 = GUICtrlCreateInput("", 2, 280, 246, 20,$ES_CENTER)
GUICtrlSetBkColor(-1, 0x7A67EE)
GUICtrlCreateLabel("*请在上面蓝色区域输入文件名或后缀名即可*", 6, 308, 246, 20)
$Button2 = GUICtrlCreateButton("程序说明", 392, 280, 123, 33,$BS_FLAT)
$Button1 = GUICtrlCreateButton("搜索", 262, 280, 123, 33,$BS_FLAT)
$Button3 = GUICtrlCreateButton("退出本程序", 522, 280, 123, 33,$BS_FLAT)

$Label1 = GUICtrlCreateLabel("搜索状态", 6, 322, 636, 34)
GUISetState(@SW_SHOW)

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button3
                        exit        

                Case  $Button2
                        MsgBox(0,"搜索提示","请直接在蓝色区域输入文件名或后缀即可!"&@CRLF&@crlf&"不输任何信息则搜索所有文件")
                        
                Case  $Button1
                        GUICtrlSetData($Label1,"搜索中....")
                        $patch="c:\"
                        $patch1="d:\"
                        
                        $lr=GUICtrlRead($input1)
                        seachfile($patch,"*",$lr);;;;;;;;;查找文件名
                        seachfile($patch1,"*",$lr);;;;;;;;;查找文件名        
        
                        GUICtrlSetData($Label1,"搜索完成")
        
EndSwitch
        
WEnd

Func seachfile($patch,$str,$mask="")
Local $search,$file,$array,$array2,$stt,$stt2
$search = FileFindFirstFile($patch&$str)  
If $search  Then
While 1        
        $file = FileFindNextFile($search) 
        If @error Then ExitLoop
        $array=StringSplit($file,".")
        $array2=StringSplit($file,"/")
        $stt=$array[UBound($array)-1]
        $stt2=$array2[UBound($array2)-1]
        if $mask<>"" Then
       if $stt=$mask  or $stt2=$mask Then
                   GUICtrlSetData($List1,$patch&$file)                 
                   GUICtrlSetData($Label1,$patch&$file)
           EndIf           
   Else          
                GUICtrlSetData($List1,$patch&$file)        
                GUICtrlSetData($Label1,$patch&$file)
        EndIf                
                if FileChangeDir( $patch&$file)=1 and $file<>"." and $file<>".." Then
                        seachfile($patch&$file&"\",$str,$mask)                                
 EndIf

WEnd
FileClose($search)
EndIf

EndFunc


发表于 2009-4-22 23:33:54 | 显示全部楼层
有人发应过AU3的文件搜索实在是低效。。呵呵
发表于 2009-9-26 01:48:28 | 显示全部楼层
路过,帮忙顶一个
发表于 2009-9-26 02:35:02 | 显示全部楼层
基本上都是很低效的,试过全盘搜索了一次,然后生成表,足足用了10多分钟时间。。。如果再做个对比,估计更久。
发表于 2009-9-26 09:37:40 | 显示全部楼层
有个api倒是挺快的,忘了怎么用了
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-6-9 12:56 , Processed in 0.085458 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表