找回密码
 加入
搜索
查看: 985|回复: 4

FileFindNextFile只能找下个文件,怎么找上个文件呢?

[复制链接]
发表于 2009-10-13 16:07:56 | 显示全部楼层 |阅读模式
本帖最后由 A175178 于 2009-10-13 16:22 编辑

无聊时写了个小脚本来更改当前桌面墙纸,但只能一个一个向下换,不能倒回去,求解决方法。
附小脚本代码:
#noTrayIcon
$g_szVersion = "_WPCG"
If WinExists($g_szVersion) Then Exit
AutoItWinSetTitle($g_szVersion)
HotKeySet("^!{NUMPAD0}","Wpexit")
HotKeySet("^!{DOWN}","WPnext")
$search = FileFindFirstFile("G:\images\WallPaper\" & @DesktopWidth & "\*.bmp")
While 1
    Sleep(500)
WEnd
Func Wpexit()
      FileClose($search)
      $sFile = 'G:\images\WallPaper\' & @year & @mon & '.bmp'
      If FileExists($sFile) Then DllCall('user32','int','SystemParametersInfo','int',20,'int',0,'str',$sFile,'int',0)
      Exit
EndFunc
Func Wpnext()
    If $search = -1 Then Exit
    $sFile = FileFindNextFile($search)
    If @error Then
       $search = FileFindFirstFile("G:\images\WallPaper\" & @DesktopWidth & "\*.bmp")
       $sFile = FileFindNextFile($search)
    EndIf
    DllCall('user32','int','SystemParametersInfo','int',20,'int',0,'str','G:\images\WallPaper\' & @DesktopWidth & '\' & $sFile,'int',0);
EndFunc
发表于 2009-10-13 16:18:52 | 显示全部楼层
用变量把所有找到的文件存起来,想哪个调用就行了。
 楼主| 发表于 2009-10-13 16:22:53 | 显示全部楼层
哦,我以为有相应的函数呢,谢谢指点!
发表于 2009-10-13 16:36:16 | 显示全部楼层
楼主,这问题问得有点太夸张了,要是都有相应的函数,是不是要第二张就直接出来第二张?
发表于 2009-10-14 23:25:22 | 显示全部楼层
留個腳印,學習了~~
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-5 01:41 , Processed in 0.075120 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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