找回密码
 加入
搜索
查看: 2335|回复: 3

请问是不是FileFindFirstFile出的问题?如果是怎样解决?

  [复制链接]
发表于 2008-8-26 20:04:00 | 显示全部楼层 |阅读模式
请问是不是FileFindFirstFile出的问题?如果是怎样解决?


#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=d:\my documents\a3\form1.kxf
$Form1_1 = GUICreate("小改名软件", 404, 188, 230, 149)
$Button1 = GUICtrlCreateButton("输入", 16, 24, 81, 33, 0)
$Button2 = GUICtrlCreateButton("输出", 16, 72, 81, 33, 0)
$Group1 = GUICtrlCreateGroup("请选择", 8, 8, 377, 105)
$Label1 = GUICtrlCreateLabel("请选择输入路径", 112, 32, 260, 17)
$Label2 = GUICtrlCreateLabel("请选技输出路径", 112, 72, 260, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button3 = GUICtrlCreateButton("开始", 48, 136, 105, 33, 0)
$Button4 = GUICtrlCreateButton("退出", 224, 136, 113, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

                Case $Button1
                        $path1 = FileSelectFolder("请选择输入文件夹:", "")
                        $Label1 = GUICtrlCreateLabel($path1, 112, 32, 260, 17)
                        
                        
                Case $Button2
                        $path2 = FileSelectFolder("请选择输出文件夹:", "")
                        $Label2 = GUICtrlCreateLabel($path2, 112, 72, 260, 17)
                        
                Case $Button3
                        rename ()
                        
                        
                        
                Case $Button4
                        Exit
        EndSwitch
WEnd


func rename ()
        $search = FileFindFirstFile($path1&"\*.jpg")  

; 检查搜索是否成功
If $search = -1 Then
    MsgBox(0, "错误", "无任何文件或文件夹与指定的搜索字符串匹配")
    Exit
EndIf

While 1
    $file = FileFindNextFile($search) 
    If @error Then ExitLoop
    
        
        $t =  FileGetTime($file, 1)
    $file2 = $t[0] & "年" & $t[1] & "月" & $t[2]&"日_"&$t[3]&"点"&$t[4]&"分"&$t[5]&"秒"
    MsgBox(0, $file&"改成了 ", $file2)
    FileCopy($path1&"\"&$file, $path2&"\"&$file2&".jpg")
        
        
        
WEnd

; 关闭搜索句柄
FileClose($search)

        
        
        
EndFunc


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
 楼主| 发表于 2008-8-26 20:06:15 | 显示全部楼层
发现如果在程序当前目录改名就不会出错。。不知怎样解决。。。
发表于 2008-8-26 22:42:48 | 显示全部楼层
用3.2.13.7版无任何问题
 楼主| 发表于 2008-8-27 07:18:09 | 显示全部楼层
原帖由 clonecd 于 2008-8-26 22:42 发表
用3.2.13.7版无任何问题

我用的就是3.2.13.7.1版。。。。。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-13 19:57 , Processed in 0.077187 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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