找回密码
 加入
搜索
查看: 3785|回复: 9

[AU3基础] [已解决]netegg 老师请进一下!关于_FileListToArray 函数的使用。

  [复制链接]
发表于 2013-1-25 20:13:11 | 显示全部楼层 |阅读模式
本帖最后由 fybhwsx 于 2013-1-25 21:37 编辑
for $i = 1 to 9
  if FileExists($TBszlj & "User" & $TBloginname & "\Desktop\我的工作区\工作区" & $i &".wsp") then
       WinMenuSelectItem("交易开拓者平台(旗舰版)", "", "文件(&F)", "打开工作区")
       WinWait("打开", "", 9)
       ControlFocus("打开", "", "Edit1")
       ControlSetText("打开", "", "Edit1", "工作区" & $i & ".wsp")
       ControlFocus("打开", "", "Button1")
       ControlClick("打开", "", "Button1")
       WinWait("交易开拓者平台(旗舰版)", "工作区" & $i, 5)
  endif
next
以上代码在默认工作区名字的情况下,能够依次打开9个工作区。现在遇到一个问题,就是把工作区改名后,无法使用了。
我查到一个函数 _FileListToArray 但不会使用,是想自动依次打开 $GZQszlj 文件夹中所有的 .wsp ,这需要获取每个工作区xxxx.wsp的名字,才能输入打开。
        Local $GZQszlj = $TBszlj & "User" & $TBloginname & "\Desktop\我的工作区"        
        Local $FileArray = _FileListToArray($GZQszlj)
        For $i = 1 To $FileArray[0]
        If FileExists("xxxx.wsp") Then
                WinMenuSelectItem("交易开拓者平台(旗舰版)", "", "文件(&F)", "打开工作区")
                WinWait("打开", "", 9)
                ControlFocus("打开", "", "Edit1")
                ControlSetText("打开", "", "Edit1", "xxxx.wsp")
                ControlFocus("打开", "", "Button1")
                ControlClick("打开", "", "Button1")
                WinWait("交易开拓者平台(旗舰版) - ", "xxxx" , 5)
        EndIf
Next
发表于 2013-1-25 20:27:15 | 显示全部楼层
$filearray= _FileListToArray($GZQszlj, '.wsp', 1)
_arraydelete($filearray, 0)
for $file in $filearray
                WinMenuSelectItem("交易开拓者平台(旗舰版)", "", "文件(&F)", "打开工作区")
                WinWait("打开", "", 9)
                ControlFocus("打开", "", "Edit1")
                ControlSetText("打开", "", "Edit1", $file)
                ControlFocus("打开", "", "Button1")
                ControlClick("打开", "", "Button1")
                WinWait("交易开拓者平台(旗舰版) - ", stringtrimright($file, 4) , 5)
next
 楼主| 发表于 2013-1-25 20:43:51 | 显示全部楼层
谢谢老师,不过我刚试了下,没能打开工作区?
发表于 2013-1-25 20:44:49 | 显示全部楼层
LZ请增加标题的问题描述
 楼主| 发表于 2013-1-25 20:49:05 | 显示全部楼层
LZ请增加标题的问题描述
afan 发表于 2013-1-25 20:44



    好的,版主,既然来了,麻烦也帮忙看看好吗?
 楼主| 发表于 2013-1-25 20:53:29 | 显示全部楼层
请问老师 $file 是怎么来的?
 楼主| 发表于 2013-1-25 21:18:43 | 显示全部楼层
$file 是返回的文件名吗?
发表于 2013-1-25 21:20:12 | 显示全部楼层
回复 7# fybhwsx
文件名数组元素
发表于 2013-1-25 21:28:17 | 显示全部楼层
回复 5# fybhwsx
        Local $GZQszlj = $TBszlj & "User" & $TBloginname & "\Desktop\我的工作区"        
        Local $FileArray = _FileListToArray($GZQszlj, '*.wsp', 1)
        For $i = 1 To $FileArray[0]
                WinMenuSelectItem("交易开拓者平台(旗舰版)", "", "文件(&F)", "打开工作区")
                WinWait("打开", "", 9)
                ControlFocus("打开", "", "Edit1")
                ControlSetText("打开", "", "Edit1", $FileArray[$i])
                ControlFocus("打开", "", "Button1")
                ControlClick("打开", "", "Button1")
                WinWait("交易开拓者平台(旗舰版) - ", StringTrimRight($FileArray[$i], 4), 5)
        Next
 楼主| 发表于 2013-1-25 21:36:35 | 显示全部楼层
回复  fybhwsx
afan 发表于 2013-1-25 21:28



    谢谢版主,问题完美解决!同时感谢netegg老师的热心帮助!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-2 18:17 , Processed in 0.082685 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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