#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#Include <File.au3>
;## 初始变量
$gc_url="http://disk.nbfas.cn/test.htm" ;上传地址
$gc_Formtitle="上传" ;窗体标题
;查看是否窗体是否存在
If WinExists($gc_Formtitle,"") Then
Exit
EndIf
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate($gc_Formtitle, 334, 283, 193, 125,-1,$WS_EX_ACCEPTFILES)
$Label1 = GUICtrlCreateLabel("选择文件夹...", 40, 40, 73, 17)
$inputDir = GUICtrlCreateInput("", 40, 72, 177, 21)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$btnBrowse = GUICtrlCreateButton("浏览...", 240, 72, 75, 25, 0)
$btnUpload = GUICtrlCreateButton("上传", 40, 120, 75, 25, 0)
$editDisplay = GUICtrlCreateEdit("", 48, 168, 185, 89, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $btnBrowse ;浏览文件夹
$dir = FileSelectFolder("请选择文件夹:", "")
If Not @error Then GUICtrlSetData($inputDir,$dir)
;## 上传
Case $btnUpload
$dir = GUICtrlRead($inputDir) ;读取文件夹
;<== 检查文件夹是否有错
If $dir="" Or _
Not StringInStr($dir,":") Or _
Not StringInStr($dir,"") Then
MsgBox(0,"出错","请检查文件夹是否正确")
GUICtrlSetState($inputDir,$GUI_FOCUS)
Else ;无错
;将选定文件夹内所有文件读入数组
$aFileList=_FileListToArray($dir,"*",1)
;<== 检查是否有文件
If @Error=4 Then ;没有文件
MsgBox (0,"","没有发现文件")
;Exit
Else ;有文件
;### 循环执行每一个文件
For $iFile=1 To $aFileList[0]
;ConsoleWrite($aFileList[$iFile] & @CRLF)
$sFilePath=$dir & "" & $aFileList[$iFile]
ConsoleWrite($sFilePath & @CRLF)
$oIE=_IECreate($gc_url,0,1)
$o_form = _IEFormGetObjByName ($oIE, "upload_form")
$o_browse = _IEFormElementGetObjByName($o_form, "file")
;$hwnd_ie = _IEPropertyGet($oIE, "hwnd")
;单击“浏览”
_IEAction($o_browse,"click")
;_IELoadWait ($oIE)
$title_dialog = "选择要加载的文件"
;$btn_file = "[CLASS:Edit;INSTANCE:1]"
;$btn_open="[CLASS:Button;INSTANCE:1]"
;就是这个不知道该怎么处理,谢谢
WinWait($title_dialog,"")
ControlSetText($title_dialog,"","Edit1","aaaaa")
;_IEAction($o_login, "click")
Next ;<== 循环结束
EndIf ;<== 检查是否有文件
EndIf ;<== 检查文件夹是否有错
EndSwitch
WEnd
----------------------------------------------------------------